feat: 登录态

This commit is contained in:
eric
2022-11-21 18:13:35 +08:00
parent df6e9e7820
commit 841b480f01
7 changed files with 125 additions and 114 deletions

2
dist/common.js vendored
View File

@@ -1,2 +1,2 @@
/*! For license information please see common.js.LICENSE.txt */
"use strict";(wx.webpackJsonp=wx.webpackJsonp||[]).push([["common"],{"./src/pages/components/ActiveCard/index.tsx":function(e,n,t){var a=t("./node_modules/@antmjs/vantui/es/button/index.js"),s=t("./node_modules/@antmjs/vantui/es/image/index.js"),i=t("./node_modules/@antmjs/vantui/es/tag/index.js"),l=t("./node_modules/@babel/runtime/helpers/esm/slicedToArray.js"),o=t("./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js"),r=t("webpack/container/remote/react"),c=t("webpack/container/remote/moment"),d=t.n(c),u=t("webpack/container/remote/react/jsx-runtime");n.default=function ActiveCard(e){var n=(0,r.useState)({}),t=(0,l.default)(n,2),c=(t[0],t[1],null==e?void 0:e.dataSource),m=c.title,x=c.address,j=c.date,p=c.tagName,v=(c.tagCode,c.Status,c.images);c.isDelete;return(0,u.jsxs)(o.View,{className:"activeCard",children:[(0,u.jsxs)(o.View,{className:"left",children:[!1,(0,u.jsx)(o.View,{className:"leftImage",children:(0,u.jsx)(s.default,{width:"100%",height:"100px",fit:"cover",src:null==v?void 0:v[0]})})]}),(0,u.jsxs)(o.View,{className:"middle",children:[(0,u.jsxs)(o.View,{className:"title",children:[(0,u.jsx)(i.default,{round:!0,type:"warning",style:{marginRight:"5px"},children:p}),(0,u.jsx)(o.Text,{children:m})]}),(0,u.jsxs)(o.View,{className:"down",children:[(0,u.jsxs)(o.View,{className:"date",children:[(0,u.jsx)(o.View,{className:"",children:x}),(0,u.jsx)(o.View,{className:"",children:d()(j).format("YYYY-MM-DD")})]}),(0,u.jsx)(o.View,{className:"btn",children:(0,u.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"),s=t("./node_modules/@antmjs/vantui/es/tabbar-item/index.js"),i=t("./node_modules/@babel/runtime/helpers/esm/slicedToArray.js"),l=t("./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js"),o=t("webpack/container/remote/@tarojs/taro"),r=t.n(o),c=t("webpack/container/remote/react"),d=t.n(c),u=t("webpack/container/remote/react/jsx-runtime");n.default=function TabbarCom(e){var n,t=d().useState(null!==(n=null==e?void 0:e.active)&&void 0!==n?n:0),o=(0,i.default)(t,2),c=o[0],m=o[1];return(0,u.jsx)(l.View,{style:{marginTop:"40px"},children:(0,u.jsxs)(a.default,{active:c,onChange:function onChange(e){console.log("e",e),m(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,u.jsx)(s.default,{icon:"home-o",children:"首页"}),(0,u.jsx)(s.default,{icon:"friends-o",children:"活动"}),(0,u.jsx)(s.default,{icon:"setting-o",children:"我的"})]})})}},"./src/utils/index.ts":function(e,n,t){t.d(n,{getTable:function(){return i},getTableid:function(){return l}});var a=t("webpack/container/remote/@tarojs/taro"),s=t.n(a),i=function getTable(e){var n=e.env,t=e.tableName,a=e.okFun,i=s().cloud.database({env:n}),l=null==i?void 0:i.collection(t);null==l||l.get({success:function success(e){a(e)}})},l=function getTableid(e){var n=e.env,t=e.tableName,a=e.id,i=e.okFun,l=s().cloud.database({env:n}),o=null==l?void 0:l.collection(t);null==o||o.doc(a).get({success:function success(e){i(e)}})}}}]);
"use strict";(wx.webpackJsonp=wx.webpackJsonp||[]).push([["common"],{"./src/pages/components/ActiveCard/index.tsx":function(e,n,t){var a=t("./node_modules/@antmjs/vantui/es/button/index.js"),s=t("./node_modules/@antmjs/vantui/es/image/index.js"),i=t("./node_modules/@antmjs/vantui/es/tag/index.js"),o=t("./node_modules/@babel/runtime/helpers/esm/slicedToArray.js"),l=t("./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js"),c=t("webpack/container/remote/react"),r=t("webpack/container/remote/moment"),d=t.n(r),u=t("webpack/container/remote/react/jsx-runtime");n.default=function ActiveCard(e){var n=(0,c.useState)({}),t=(0,o.default)(n,2),r=(t[0],t[1],null==e?void 0:e.dataSource),m=r.title,p=r.address,f=r.date,j=r.tagName,x=(r.tagCode,r.Status,r.images);r.isDelete;return(0,u.jsxs)(l.View,{className:"activeCard",children:[(0,u.jsxs)(l.View,{className:"left",children:[!1,(0,u.jsx)(l.View,{className:"leftImage",children:(0,u.jsx)(s.default,{width:"100%",height:"100px",fit:"cover",src:null==x?void 0:x[0]})})]}),(0,u.jsxs)(l.View,{className:"middle",children:[(0,u.jsxs)(l.View,{className:"title",children:[(0,u.jsx)(i.default,{round:!0,type:"warning",style:{marginRight:"5px"},children:j}),(0,u.jsx)(l.Text,{children:m})]}),(0,u.jsxs)(l.View,{className:"down",children:[(0,u.jsxs)(l.View,{className:"date",children:[(0,u.jsx)(l.View,{className:"",children:p}),(0,u.jsx)(l.View,{className:"",children:d()(f).format("YYYY-MM-DD")})]}),(0,u.jsx)(l.View,{className:"btn",children:(0,u.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"),s=t("./node_modules/@antmjs/vantui/es/tabbar-item/index.js"),i=t("./node_modules/@babel/runtime/helpers/esm/slicedToArray.js"),o=t("./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js"),l=t("webpack/container/remote/@tarojs/taro"),c=t.n(l),r=t("webpack/container/remote/react"),d=t.n(r),u=t("webpack/container/remote/react/jsx-runtime");n.default=function TabbarCom(e){var n,t=d().useState(null!==(n=null==e?void 0:e.active)&&void 0!==n?n:0),l=(0,i.default)(t,2),r=l[0],m=l[1];return(0,u.jsx)(o.View,{style:{marginTop:"40px"},children:(0,u.jsxs)(a.default,{active:r,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,u.jsx)(s.default,{icon:"home-o",children:"首页"}),(0,u.jsx)(s.default,{icon:"friends-o",children:"活动"}),(0,u.jsx)(s.default,{icon:"setting-o",children:"我的"})]})})}},"./src/utils/index.ts":function(e,n,t){t.d(n,{getTable:function(){return i},getTableid:function(){return o},updateTableid:function(){return l},isLogin:function(){return c}});var a=t("webpack/container/remote/@tarojs/taro"),s=t.n(a),i=function getTable(e){var n=e.env,t=e.tableName,a=e.okFun,i=s().cloud.database({env:n}),o=null==i?void 0:i.collection(t);null==o||o.get({success:function success(e){a(e)}})},o=function getTableid(e){var n=e.env,t=e.tableName,a=e.id,i=e.okFun,o=s().cloud.database({env:n}),l=null==o?void 0:o.collection(t);null==l||l.doc(a).get({success:function success(e){i(e)}})},l=function updateTableid(e){var n=e.env,t=e.tableName,a=e.objData,i=e.id,o=e.okFun,l=s().cloud.database({env:n});(null==l?void 0:l.collection(t)).doc(i).update({data:a,success:function success(e){o(e)}})},c=function isLogin(){s().checkSession({success:function success(e){return console.log("res",e),!0},fail:function fail(e){return console.log("err",e),!1}})}}}]);

View File

@@ -1,2 +1,2 @@
/*! For license information please see index.js.LICENSE.txt */
"use strict";(wx.webpackJsonp=wx.webpackJsonp||[]).push([["pages/activityList/components/details/index"],{"./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??ruleSet[1].rules[9].use[1]!./src/pages/activityList/components/details/index.tsx":function(e,t,n){var l=n("./node_modules/@antmjs/vantui/es/button/index.js"),i=n("./node_modules/@antmjs/vantui/es/toast/index.js"),s=n("./node_modules/@antmjs/vantui/es/cell/index.js"),o=n("./node_modules/@antmjs/vantui/es/image/index.js"),a=n("./node_modules/@babel/runtime/helpers/esm/slicedToArray.js"),d=n("./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js"),c=n("webpack/container/remote/@tarojs/taro"),u=n.n(c),r=n("webpack/container/remote/react"),v=n("./src/utils/index.ts"),m=n("webpack/container/remote/react/jsx-runtime");t.default=function details(){var e,t,n,x,f,p,j=(0,r.useState)([]),b=(0,a.default)(j,2),g=b[0],h=b[1],k=(0,r.useState)(0),w=(0,a.default)(k,2),y=w[0],T=w[1],_=(0,c.getCurrentInstance)(),C=(null!==(e=null==_||null===(t=_.router)||void 0===t?void 0:t.params)&&void 0!==e?e:{}).id;(0,r.useEffect)((function(){}),[]),(0,r.useEffect)((function(){var e,t=u().getSystemInfoSync(),n=t.screenHeight,l=t.safeArea,i=void 0===l?{}:l,s=null!==(e=n-(null==i?void 0:i.bottom))&&void 0!==e?e:0;T(s);var o={tableName:"details",id:C,okFun:function okFun(e){var t;console.log("res",e),h(null!==(t=null==e?void 0:e.data)&&void 0!==t?t:[])}};(0,v.getTableid)(o)}),[]);return(0,m.jsxs)(d.View,{className:"detailContent",children:[(0,m.jsxs)(d.View,{children:[(0,m.jsx)(d.View,{children:null==g?void 0:g.title}),(0,m.jsx)(o.default,{width:"100%",height:"180px",fit:"cover",src:null==g||null===(n=g.images)||void 0===n||null===(x=n[0])||void 0===x?void 0:x.url}),(0,m.jsxs)(d.View,{children:[(0,m.jsx)(s.default,{icon:"clock",title:"开始时间 ".concat(null==g?void 0:g.startTime)}),(0,m.jsx)(s.default,{icon:"clock",title:"结束时间 ".concat(null==g?void 0:g.endTime)}),(0,m.jsx)(s.default,{isLink:!0,icon:"location",title:"".concat(null==g?void 0:g.address),linkType:"navigateTo",url:"/pages/dashboard/index"}),(0,m.jsx)(s.default,{icon:"friends",title:"已报名人数 ".concat(null!==(f=null==g||null===(p=g.useridArr)||void 0===p?void 0:p.length)&&void 0!==f?f:0)})]})]}),(0,m.jsx)(d.View,{onClick:function onClick(){},className:"RichText",children:(0,m.jsx)(d.RichText,{nodes:null==g?void 0:g.richText})}),(0,m.jsxs)(d.View,{className:"detailBtn",style:{bottom:"".concat(null!=y?y:0,"px")},onClick:function onClick(){u().checkSession({success:function success(e){console.log("res",e)},fail:function fail(e){console.log("err",e),i.default.fail({message:"请先登录",selector:"#vanToast-demo2",duration:2e3,onClose:function onClose(){u().navigateTo({url:"/pages/my/index"})}})}})},children:[(0,m.jsx)(l.default,{type:"primary",block:!0,disabled:!["1"].includes(null==g?void 0:g.Status),children:[{label:"活动待开放",value:"0"},{label:"立即报名",value:"1"},{label:"活动已取消",value:"2"},{label:"活动进行中",value:"3"},{label:"活动已结束",value:"4"},{label:"活动已关闭",value:"5"}].map((function(e){var t=null==g?void 0:g.Status;if((null==e?void 0:e.value)===t)return null==e?void 0:e.label}))}),(0,m.jsx)(i.default,{id:"vanToast-demo2"})]})]})}},"./src/pages/activityList/components/details/index.tsx":function(e,t,n){var l=n("webpack/container/remote/@tarojs/runtime"),i=n("./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??ruleSet[1].rules[9].use[1]!./src/pages/activityList/components/details/index.tsx");Page((0,l.createPageConfig)(i.default,"pages/activityList/components/details/index",{root:{cn:[]}},{navigationBarTitleText:"活动详情"}||{}))}},function(e){e.O(0,["taro","vendors","common"],(function(){return t="./src/pages/activityList/components/details/index.tsx",e(e.s=t);var t}));e.O()}]);
"use strict";(wx.webpackJsonp=wx.webpackJsonp||[]).push([["pages/activityList/components/details/index"],{"./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??ruleSet[1].rules[9].use[1]!./src/pages/activityList/components/details/index.tsx":function(e,t,n){var o=n("./node_modules/@antmjs/vantui/es/button/index.js"),l=n("./node_modules/@babel/runtime/helpers/esm/objectSpread2.js"),i=n("./node_modules/@antmjs/vantui/es/toast/index.js"),s=n("./node_modules/@antmjs/vantui/es/cell/index.js"),a=n("./node_modules/@antmjs/vantui/es/image/index.js"),r=n("./node_modules/@babel/runtime/helpers/esm/slicedToArray.js"),d=n("./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js"),c=n("webpack/container/remote/@tarojs/taro"),u=n.n(c),m=n("webpack/container/remote/react"),p=n("./src/utils/index.ts"),v=n("webpack/container/remote/react/jsx-runtime");t.default=function details(){var e,t,n,b,f,j,x=(0,m.useState)([]),g=(0,r.default)(x,2),y=g[0],h=g[1],w=(0,m.useState)(0),k=(0,r.default)(w,2),O=k[0],T=k[1],_=(0,c.getCurrentInstance)(),S=(null!==(e=null==_||null===(t=_.router)||void 0===t?void 0:t.params)&&void 0!==e?e:{}).id;(0,m.useEffect)((function(){}),[]),(0,m.useEffect)((function(){var e,t=u().getSystemInfoSync(),n=t.screenHeight,o=t.safeArea,l=void 0===o?{}:o,i=null!==(e=n-(null==l?void 0:l.bottom))&&void 0!==e?e:0;T(i);var s={tableName:"details",id:S,okFun:function okFun(e){var t;console.log("res",e),h(null!==(t=null==e?void 0:e.data)&&void 0!==t?t:[])}};(0,p.getTableid)(s)}),[]);return(0,v.jsxs)(d.View,{className:"detailContent",children:[(0,v.jsxs)(d.View,{children:[(0,v.jsx)(d.View,{children:null==y?void 0:y.title}),(0,v.jsx)(a.default,{width:"100%",height:"180px",fit:"cover",src:null==y||null===(n=y.images)||void 0===n||null===(b=n[0])||void 0===b?void 0:b.url}),(0,v.jsxs)(d.View,{children:[(0,v.jsx)(s.default,{icon:"clock",title:"开始时间 ".concat(null==y?void 0:y.startTime)}),(0,v.jsx)(s.default,{icon:"clock",title:"结束时间 ".concat(null==y?void 0:y.endTime)}),(0,v.jsx)(s.default,{isLink:!0,icon:"location",title:"".concat(null==y?void 0:y.address),linkType:"navigateTo",url:"/pages/dashboard/index"}),(0,v.jsx)(s.default,{icon:"friends",title:"已报名人数 ".concat(null!==(f=null==y||null===(j=y.useridArr)||void 0===j?void 0:j.length)&&void 0!==f?f:0)})]})]}),(0,v.jsx)(d.View,{onClick:function onClick(){},className:"RichText",children:(0,v.jsx)(d.RichText,{nodes:null==y?void 0:y.richText})}),(0,v.jsxs)(d.View,{className:"detailBtn",style:{bottom:"".concat(null!=O?O:0,"px")},onClick:function onClick(){if((0,p.isLogin)()){console.log("id",S);var e={id:S,tableName:"details",objData:{useridArr:["openid"]},okFun:function okFun(e){console.log("res",e)}};console.log("postData",e),(0,p.updateTableid)((0,l.default)({},e))}else i.default.fail({message:"请先登录",selector:"#vanToast-demo2",duration:2e3,onClose:function onClose(){u().navigateTo({url:"/pages/my/index"})}})},children:[(0,v.jsx)(o.default,{type:"primary",block:!0,disabled:!["1"].includes(null==y?void 0:y.Status),children:[{label:"活动待开放",value:"0"},{label:"立即报名",value:"1"},{label:"活动已取消",value:"2"},{label:"活动进行中",value:"3"},{label:"活动已结束",value:"4"},{label:"活动已关闭",value:"5"}].map((function(e){var t=null==y?void 0:y.Status;if((null==e?void 0:e.value)===t)return null==e?void 0:e.label}))}),(0,v.jsx)(i.default,{id:"vanToast-demo2"})]})]})}},"./src/pages/activityList/components/details/index.tsx":function(e,t,n){var o=n("webpack/container/remote/@tarojs/runtime"),l=n("./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??ruleSet[1].rules[9].use[1]!./src/pages/activityList/components/details/index.tsx");Page((0,o.createPageConfig)(l.default,"pages/activityList/components/details/index",{root:{cn:[]}},{navigationBarTitleText:"活动详情"}||{}))},"./node_modules/@babel/runtime/helpers/esm/objectSpread2.js":function(e,t,n){n.d(t,{default:function(){return _objectSpread2}});var o=n("./node_modules/@babel/runtime/helpers/esm/defineProperty.js");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 _objectSpread2(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(n),!0).forEach((function(t){(0,o.default)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ownKeys(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}}},function(e){e.O(0,["taro","vendors","common"],(function(){return t="./src/pages/activityList/components/details/index.tsx",e(e.s=t);var t}));e.O()}]);

View File

@@ -2,6 +2,10 @@
/*! ../../../../utils/index */
/*! ./defineProperty.js */
/*! ./node_modules/@babel/runtime/helpers/esm/objectSpread2.js */
/*! ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js */
/*! @antmjs/vantui/es/button */
@@ -26,6 +30,10 @@
!*** ./src/pages/activityList/components/details/index.tsx ***!
\*************************************************************/
/*!******************************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/esm/objectSpread2.js ***!
\******************************************************************/
/*!***************************************************************************************************************************************************************************!*\
!*** ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??ruleSet[1].rules[9].use[1]!./src/pages/activityList/components/details/index.tsx ***!
\***************************************************************************************************************************************************************************/

View File

@@ -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/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,n,t){var s=t("./node_modules/@antmjs/vantui/es/cell/index.js"),o=t("./node_modules/@antmjs/vantui/es/button/index.js"),a=t("./node_modules/@antmjs/vantui/es/image/index.js"),i=t("./node_modules/@babel/runtime/helpers/esm/slicedToArray.js"),l=t("./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js"),c=t("webpack/container/remote/react"),d=t("./src/pages/components/TabbarCom/index.tsx"),r=t("webpack/container/remote/@tarojs/taro"),u=t.n(r),m=(t("./src/pages/components/ActiveCard/index.tsx"),t("./src/utils/index.ts")),x=t("webpack/container/remote/react/jsx-runtime");n.default=function my(e){var n=(0,c.useState)({}),t=(0,i.default)(n,2),r=(t[0],t[1],(0,c.useState)([])),g=(0,i.default)(r,2),f=(g[0],g[1]),p=(0,c.useState)(0),j=(0,i.default)(p,2);j[0],j[1];(0,c.useEffect)((function(){!function getDetails(){var e={tableName:"details",okFun:function okFun(e){var n;console.log("details--",e),f(null!==(n=null==e?void 0:e.data)&&void 0!==n?n:[])}};(0,m.getTable)(e)}()}),[]);var b=function getPhoneNumber(e){console.log("点击获取手机事件",e.detail.cloudID),function getLogin(e){u().cloud.callFunction({name:"getPhoneNum",data:{weRunData:u().cloud.CloudID(e.detail.cloudID)}}).then((function(e){console.log("res11"),console.log("res",e)}))}(e)};return(0,x.jsxs)(l.View,{className:"myContent",children:[(0,x.jsxs)(l.View,{className:"myImage",children:[(0,x.jsx)(a.default,{round:!0,width:"100px",height:"100px",src:"cloud://cloud1-5g5xrgza12a0dd6d.636c-cloud1-5g5xrgza12a0dd6d-1253665791/images/images-2.jpg"}),(0,x.jsx)(l.View,{className:"loginBtn",children:(0,x.jsx)(o.default,{type:"primary",size:"mini","open-type":"getPhoneNumber",lang:"zh_CN",onGetPhoneNumber:function onGetPhoneNumber(e){console.log("info",e),b(e)},children:"登录"})})]}),(0,x.jsxs)(l.View,{className:"cellArr",children:[(0,x.jsx)(s.default,{icon:"manager",title:"打卡记录",isLink:!0}),(0,x.jsx)(s.default,{title:"微信客服",icon:"wechat",isLink:!0,value:"",onClick:function onClick(){u().openCustomerServiceChat({corpId:"wwb04af9a97514271c",extInfo:{url:"https://work.weixin.qq.com/kfid/kfc70f3f112c97a54c5"},success:function success(e){}})}}),(0,x.jsx)(s.default,{icon:"friends",title:"关于我们",isLink:!0}),(0,x.jsx)(s.default,{icon:"setting",title:"版本日志",isLink:!0,onClick:function onClick(){u().navigateTo({url:"/pages/my/components/Version/index"})}})]}),(0,x.jsx)(d.default,{active:2})]})}},"./src/pages/my/index.tsx":function(e,n,t){var s=t("webpack/container/remote/@tarojs/runtime"),o=t("./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,s.createPageConfig)(o.default,"pages/my/index",{root:{cn:[]}},{navigationBarTitleText:"我的"}||{}))}},function(e){e.O(0,["taro","vendors","common"],(function(){return n="./src/pages/my/index.tsx",e(e.s=n);var n}));e.O()}]);
"use strict";(wx.webpackJsonp=wx.webpackJsonp||[]).push([["pages/my/index"],{"./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,n,t){var s=t("./node_modules/@antmjs/vantui/es/cell/index.js"),o=t("./node_modules/@antmjs/vantui/es/button/index.js"),a=t("./node_modules/@antmjs/vantui/es/image/index.js"),i=t("./node_modules/@babel/runtime/helpers/esm/slicedToArray.js"),c=t("./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js"),l=t("webpack/container/remote/react"),d=t("./src/pages/components/TabbarCom/index.tsx"),u=t("webpack/container/remote/@tarojs/taro"),r=t.n(u),m=(t("./src/pages/components/ActiveCard/index.tsx"),t("./src/utils/index.ts")),f=t("webpack/container/remote/react/jsx-runtime");n.default=function my(e){var n=(0,l.useState)({}),t=(0,i.default)(n,2),u=(t[0],t[1],(0,l.useState)([])),g=(0,i.default)(u,2),x=(g[0],g[1]),p=(0,l.useState)(0),j=(0,i.default)(p,2),b=(j[0],j[1],(0,l.useState)(!1)),h=(0,i.default)(b,2),v=h[0],w=h[1];(0,l.useEffect)((function(){var e=(0,m.isLogin)();w(e)}),[]);(0,l.useEffect)((function(){!function getDetails(){var e={tableName:"details",okFun:function okFun(e){var n;console.log("details--",e),x(null!==(n=null==e?void 0:e.data)&&void 0!==n?n:[])}};(0,m.getTable)(e)}()}),[]);var k=function getPhoneNumber(e){console.log("点击获取手机事件",e.detail.cloudID),function getLogin(e){r().cloud.callFunction({name:"getPhoneNum",data:{weRunData:r().cloud.CloudID(e.detail.cloudID)}}).then((function(e){console.log("res11"),console.log("res",e),w(!0)}))}(e)};return(0,f.jsxs)(c.View,{className:"myContent",children:[(0,f.jsxs)(c.View,{className:"myImage",children:[(0,f.jsx)(a.default,{round:!0,width:"100px",height:"100px",src:"cloud://cloud1-5g5xrgza12a0dd6d.636c-cloud1-5g5xrgza12a0dd6d-1253665791/images/images-2.jpg"}),!v&&(0,f.jsx)(c.View,{className:"loginBtn",children:(0,f.jsx)(o.default,{type:"primary",size:"mini","open-type":"getPhoneNumber",lang:"zh_CN",onGetPhoneNumber:function onGetPhoneNumber(e){console.log("info",e),k(e)},children:"登录"})})]}),(0,f.jsxs)(c.View,{className:"cellArr",children:[(0,f.jsx)(s.default,{icon:"manager",title:"打卡记录",isLink:!0}),(0,f.jsx)(s.default,{title:"微信客服",icon:"wechat",isLink:!0,value:"",onClick:function onClick(){r().openCustomerServiceChat({corpId:"wwb04af9a97514271c",extInfo:{url:"https://work.weixin.qq.com/kfid/kfc70f3f112c97a54c5"},success:function success(e){}})}}),(0,f.jsx)(s.default,{icon:"friends",title:"关于我们",isLink:!0}),(0,f.jsx)(s.default,{icon:"setting",title:"版本日志",isLink:!0,onClick:function onClick(){r().navigateTo({url:"/pages/my/components/Version/index"})}})]}),(0,f.jsx)(d.default,{active:2})]})}},"./src/pages/my/index.tsx":function(e,n,t){var s=t("webpack/container/remote/@tarojs/runtime"),o=t("./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,s.createPageConfig)(o.default,"pages/my/index",{root:{cn:[]}},{navigationBarTitleText:"我的"}||{}))}},function(e){e.O(0,["taro","vendors","common"],(function(){return n="./src/pages/my/index.tsx",e(e.s=n);var n}));e.O()}]);

View File

@@ -6,6 +6,7 @@ import {
addTable,
getTable,
getTableid,
isLogin,
updateTableid,
} from "../../../../utils/index";
import "./index.scss";
@@ -141,59 +142,39 @@ const details = () => {
className={`detailBtn`}
style={{ bottom: `${bottomheight ?? 0}px` }}
onClick={() => {
// 检查登录态,获取openid
Taro.checkSession({
success: function (res: any) {
//session_key 未过期,并且在本生命周期一直有效
console.log("res", res);
// 获取用户openid
},
fail: function (err: any) {
console.log("err", err);
// session_key 已经失效,需要重新执行登录流程
//重新登录- 跳转到我的页面
Toast.fail({
message: '请先登录',
selector: '#vanToast-demo2',
duration:2000,
onClose: () => {
// 跳转到目的页面,打开新页面
Taro.navigateTo({
url: "/pages/my/index",
});
},
})
let isin: any = isLogin();
if (!isin) {
//重新登录- 跳转到我的页面
Toast.fail({
message: "请先登录",
selector: "#vanToast-demo2",
duration: 2000,
onClose: () => {
// 跳转到目的页面,打开新页面
Taro.navigateTo({
url: "/pages/my/index",
});
},
});
} else {
console.log("id", id);
// 立即报名
let postData = {
// env: "any",
id: id,
tableName: "details",
objData: {
// ..._.cloneDeep(dataSource),
useridArr: ["openid"],
},
okFun: (res: any) => {
console.log("res", res);
},
};
// Taro.login({
// success:(res:any)=>{
// console.log('sures--',res)
// // 获取code,获取用户的openid
// },fail:(err:any)=>{
// console.log("err",err)
// }
// })
},
});
// console.log('id',id)
// // 立即报名
// let postData={
// // env: "any",
// id:id,
// tableName: "details",
// objData: {
// // ..._.cloneDeep(dataSource),
// useridArr:['openid']
// },
// okFun: (res:any)=>{
// console.log('res',res)
// }
// }
// console.log('postData',postData)
// updateTableid({...postData})
console.log("postData", postData);
updateTableid({ ...postData });
}
}}
>
{/* style={{width:'375px'}} */}

View File

@@ -16,7 +16,7 @@ import "./index.module.scss";
import { Tab, Tabs } from "@antmjs/vantui";
import Taro from "@tarojs/taro";
import ActiveCard from "../components/ActiveCard";
import { getTable } from "../../utils/index";
import { getTable, isLogin } from "../../utils/index";
const my = (props: any) => {
// const [active, setActive] = react.useState(props?.active ?? 0);
@@ -24,6 +24,12 @@ const my = (props: any) => {
const [userInfo, setuserInfo] = useState({}); //用户信息
const [detailsData, setdetailsData] = useState<any>([]); //活动详情
const [currentIndex, setcurrentIndex] = useState(0);
const [isin,setisin]=useState(false)
useEffect(()=>{
let isin: any = isLogin();
setisin(isin)
},[])
// 云函数,-获取手机号
const getLogin = (e: any) => {
@@ -37,9 +43,7 @@ const my = (props: any) => {
.then((res: any) => {
console.log("res11");
console.log("res", res);
// this.setState({
// context: res.result,
// });
setisin(true)
});
};
@@ -118,7 +122,7 @@ const my = (props: any) => {
src="cloud://cloud1-5g5xrgza12a0dd6d.636c-cloud1-5g5xrgza12a0dd6d-1253665791/images/images-2.jpg"
/>
<View className="loginBtn">
{!isin&& <View className="loginBtn">
<Button
type="primary"
size="mini"
@@ -128,7 +132,7 @@ const my = (props: any) => {
>
</Button>
</View>
</View>}
</View>
{/* <View>

View File

@@ -1,7 +1,7 @@
import { Toast } from "@antmjs/vantui";
import Taro from "@tarojs/taro";
import { getCurrentInstance } from "@tarojs/taro";
// 数据库环境
// const db: any = Taro.cloud.database({
// env: "cloud1-5g5xrgza12a0dd6d",
@@ -9,18 +9,18 @@ import { getCurrentInstance } from "@tarojs/taro";
interface Typeint {
env?: any;
id?:any
id?: any;
tableName: any;
objData?: any;
okFun: any;
}
const params=()=>{
const params = () => {
let $instance: any = getCurrentInstance();
return $instance.router.params;
}
};
// 添加数据
export const addTable: any = ({ env,tableName, objData, okFun }: Typeint) => {
export const addTable: any = ({ env, tableName, objData, okFun }: Typeint) => {
// 数据库环境
const db: any = Taro.cloud.database({
env: env,
@@ -36,24 +36,23 @@ export const addTable: any = ({ env,tableName, objData, okFun }: Typeint) => {
});
};
// 获取指定集合数据表
export const getTable: any = ({ env,tableName, okFun }: Typeint) => {
// 数据库环境
const db: any = Taro.cloud.database({
env: env,
});
let nowtable: any = db?.collection(tableName);
nowtable?.get({
success: (res: any) => {
okFun(res);
},
});
};
export const getTable: any = ({ env, tableName, okFun }: Typeint) => {
// 数据库环境
const db: any = Taro.cloud.database({
env: env,
});
// 获取指定id数据数据
export const getTableid: any = ({ env,tableName, id, okFun }: Typeint) => {
let nowtable: any = db?.collection(tableName);
nowtable?.get({
success: (res: any) => {
okFun(res);
},
});
};
// 获取指定id数据数据
export const getTableid: any = ({ env, tableName, id, okFun }: Typeint) => {
// 数据库环境
const db: any = Taro.cloud.database({
env: env,
@@ -67,39 +66,58 @@ export const getTableid: any = ({ env,tableName, id, okFun }: Typeint) => {
});
};
// 更新数据
export const updateTableid: any = ({ env,tableName,objData, id, okFun }: Typeint) => {
// 数据库环境
const db: any = Taro.cloud.database({
env: env,
});
let nowtable: any = db?.collection(tableName);
nowtable.doc(id).update({
// 更新数据
export const updateTableid: any = ({
env,
tableName,
objData,
id,
okFun,
}: Typeint) => {
// 数据库环境
const db: any = Taro.cloud.database({
env: env,
});
let nowtable: any = db?.collection(tableName);
nowtable.doc(id).update({
// nowtable.doc(id).set({
// data 传入需要局部更新的数据
data: objData,
success: (res: any) => {
okFun(res);
},
})
};
// data 传入需要局部更新的数据
data: objData,
success: (res: any) => {
okFun(res);
},
});
};
// 删除数据
export const deleteTableid: any = ({ env,tableName, id, okFun }: Typeint) => {
// 数据库环境
const db: any = Taro.cloud.database({
env: env,
});
let nowtable: any = db?.collection(tableName);
nowtable.doc(id).remove({
success: (res: any) => {
okFun(res);
},
})
};
// 删除数据
export const deleteTableid: any = ({ env, tableName, id, okFun }: Typeint) => {
// 数据库环境
const db: any = Taro.cloud.database({
env: env,
});
let nowtable: any = db?.collection(tableName);
nowtable.doc(id).remove({
success: (res: any) => {
okFun(res);
},
});
};
export const isLogin = () => {
// 检查登录态,获取openid
Taro.checkSession({
success: function (res: any) {
//session_key 未过期,并且在本生命周期一直有效
console.log("res", res);
return true;
// 获取用户openid
},
fail: function (err: any) {
console.log("err", err);
// session_key 已经失效,需要重新执行登录流程
return false;
},
});
};