feat: 登录态处理
This commit is contained in:
2
dist/app.js
vendored
2
dist/app.js
vendored
File diff suppressed because one or more lines are too long
@@ -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 i=n("./node_modules/@antmjs/vantui/es/button/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"),l=n("./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js"),d=n("webpack/container/remote/@tarojs/taro"),c=n.n(d),r=n("webpack/container/remote/react"),u=n("./src/utils/index.ts"),m=n("webpack/container/remote/react/jsx-runtime");t.default=function details(){var e,t,n,v,x,p,j=(0,r.useState)([]),f=(0,a.default)(j,2),g=f[0],b=f[1],h=(0,r.useState)(0),w=(0,a.default)(h,2),k=w[0],y=w[1],T=(0,d.getCurrentInstance)(),_=(null!==(e=null==T||null===(t=T.router)||void 0===t?void 0:t.params)&&void 0!==e?e:{}).id;return(0,r.useEffect)((function(){}),[]),(0,r.useEffect)((function(){var e,t=c().getSystemInfoSync(),n=t.screenHeight,i=t.safeArea,s=void 0===i?{}:i,o=null!==(e=n-(null==s?void 0:s.bottom))&&void 0!==e?e:0;y(o);var a={tableName:"details",id:_,okFun:function okFun(e){var t;console.log("res",e),b(null!==(t=null==e?void 0:e.data)&&void 0!==t?t:[])}};(0,u.getTableid)(a)}),[]),(0,m.jsxs)(l.View,{className:"detailContent",children:[(0,m.jsxs)(l.View,{children:[(0,m.jsx)(l.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===(v=n[0])||void 0===v?void 0:v.url}),(0,m.jsxs)(l.View,{children:[(0,m.jsx)(s.default,{icon:"clock",title:"开始时间 ".concat(null==g?void 0:g.startTime)}),(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!==(x=null==g||null===(p=g.useridArr)||void 0===p?void 0:p.length)&&void 0!==x?x:0)})]})]}),(0,m.jsx)(l.View,{onClick:function onClick(){},className:"RichText",children:(0,m.jsx)(l.RichText,{nodes:null==g?void 0:g.richText})}),(0,m.jsx)(l.View,{className:"detailBtn",style:{bottom:"".concat(null!=k?k:0,"px")},children:(0,m.jsx)(i.default,{type:"primary",block:!0,children:"立即参加"})})]})}},"./src/pages/activityList/components/details/index.tsx":function(e,t,n){var i=n("webpack/container/remote/@tarojs/runtime"),s=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,i.createPageConfig)(s.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 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()}]);
|
||||
@@ -10,6 +10,8 @@
|
||||
|
||||
/*! @antmjs/vantui/es/image */
|
||||
|
||||
/*! @antmjs/vantui/es/toast */
|
||||
|
||||
/*! @tarojs/components */
|
||||
|
||||
/*! @tarojs/runtime */
|
||||
|
||||
2
dist/prebundle/remoteEntry.js
vendored
2
dist/prebundle/remoteEntry.js
vendored
File diff suppressed because one or more lines are too long
2
dist/prebundle/remoteEntry.js.LICENSE.txt
vendored
2
dist/prebundle/remoteEntry.js.LICENSE.txt
vendored
@@ -8,6 +8,8 @@
|
||||
|
||||
/*! ./node_modules/.taro/weapp/prebundle/@tarojs_taro.js */
|
||||
|
||||
/*! ./node_modules/.taro/weapp/prebundle/lodash.js */
|
||||
|
||||
/*! ./node_modules/.taro/weapp/prebundle/moment.js */
|
||||
|
||||
/*! ./node_modules/.taro/weapp/prebundle/react-dom.js */
|
||||
|
||||
@@ -1,10 +1,16 @@
|
||||
import { Button, Cell } from "@antmjs/vantui";
|
||||
import { Button, Cell, Toast } from "@antmjs/vantui";
|
||||
import { RichText, View } from "@tarojs/components";
|
||||
import Taro, { getCurrentInstance } from "@tarojs/taro";
|
||||
import react, { useEffect, useState } from "react";
|
||||
import { getTable, getTableid } from "../../../../utils/index";
|
||||
import {
|
||||
addTable,
|
||||
getTable,
|
||||
getTableid,
|
||||
updateTableid,
|
||||
} from "../../../../utils/index";
|
||||
import "./index.scss";
|
||||
import { Image } from "@antmjs/vantui";
|
||||
import _ from "lodash";
|
||||
|
||||
const details = () => {
|
||||
const [dataSource, setdataSource] = useState<any>([]);
|
||||
@@ -39,6 +45,33 @@ const details = () => {
|
||||
|
||||
// console.log('SafeAreaResult',Taro.getSystemInfoSync())
|
||||
|
||||
const btnStatus = [
|
||||
{
|
||||
label: "活动待开放",
|
||||
value: "0",
|
||||
},
|
||||
{
|
||||
label: "立即报名", //开放中
|
||||
value: "1",
|
||||
},
|
||||
{
|
||||
label: "活动已取消",
|
||||
value: "2",
|
||||
},
|
||||
{
|
||||
label: "活动进行中",
|
||||
value: "3",
|
||||
},
|
||||
{
|
||||
label: "活动已结束",
|
||||
value: "4",
|
||||
},
|
||||
{
|
||||
label: "活动已关闭",
|
||||
value: "5",
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<View className={`detailContent`}>
|
||||
<View>
|
||||
@@ -58,6 +91,13 @@ const details = () => {
|
||||
// linkType="navigateTo"
|
||||
// url="/pages/dashboard/index"
|
||||
/>
|
||||
<Cell
|
||||
icon="clock"
|
||||
title={`结束时间 ${dataSource?.endTime}`}
|
||||
// isLink
|
||||
// linkType="navigateTo"
|
||||
// url="/pages/dashboard/index"
|
||||
/>
|
||||
<Cell
|
||||
isLink
|
||||
icon="location"
|
||||
@@ -68,7 +108,7 @@ const details = () => {
|
||||
|
||||
<Cell
|
||||
icon="friends"
|
||||
title={`已报名人数 ${dataSource?.useridArr?.length??0}`}
|
||||
title={`已报名人数 ${dataSource?.useridArr?.length ?? 0}`}
|
||||
// isLink
|
||||
// linkType="navigateTo"
|
||||
// url="/pages/dashboard/index"
|
||||
@@ -100,11 +140,77 @@ const details = () => {
|
||||
<View
|
||||
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",
|
||||
});
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
// 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})
|
||||
}}
|
||||
>
|
||||
{/* style={{width:'375px'}} */}
|
||||
<Button type="primary" block>
|
||||
立即参加
|
||||
<Button
|
||||
type="primary"
|
||||
block
|
||||
disabled={!["1"].includes(dataSource?.Status)}
|
||||
>
|
||||
{/* 立即参加 */}
|
||||
{btnStatus.map((item: any) => {
|
||||
let status: any = dataSource?.Status;
|
||||
if (item?.value === status) {
|
||||
return item?.label;
|
||||
}
|
||||
})}
|
||||
</Button>
|
||||
<Toast id="vanToast-demo2" />
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
|
||||
@@ -36,6 +36,7 @@ export const addTable: any = ({ env,tableName, objData, okFun }: Typeint) => {
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
// 获取指定集合数据表
|
||||
export const getTable: any = ({ env,tableName, okFun }: Typeint) => {
|
||||
// 数据库环境
|
||||
@@ -77,6 +78,7 @@ export const updateTableid: any = ({ env,tableName,objData, id, okFun }: Typeint
|
||||
});
|
||||
let nowtable: any = db?.collection(tableName);
|
||||
nowtable.doc(id).update({
|
||||
// nowtable.doc(id).set({
|
||||
// data 传入需要局部更新的数据
|
||||
data: objData,
|
||||
success: (res: any) => {
|
||||
|
||||
Reference in New Issue
Block a user