feat: 活动详情
This commit is contained in:
2
dist/common.js
vendored
2
dist/common.js
vendored
@@ -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,a){var s=a("./node_modules/@antmjs/vantui/es/button/index.js"),t=a("./node_modules/@antmjs/vantui/es/image/index.js"),i=a("./node_modules/@antmjs/vantui/es/tag/index.js"),l=a("./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js"),o=a("webpack/container/remote/react/jsx-runtime");n.default=function ActiveCard(){return(0,o.jsxs)(l.View,{className:"activeCard",children:[(0,o.jsxs)(l.View,{className:"left",children:[!1,(0,o.jsx)(l.View,{className:"leftImage",children:(0,o.jsx)(t.default,{width:"100%",height:"100px",fit:"cover",src:"cloud://cloud1-5g5xrgza12a0dd6d.636c-cloud1-5g5xrgza12a0dd6d-1253665791/images/v4-460px-Climb-a-Mountain-Step-9.jpg"})})]}),(0,o.jsxs)(l.View,{className:"middle",children:[(0,o.jsxs)(l.View,{className:"title",children:[(0,o.jsx)(i.default,{round:!0,type:"warning",style:{marginRight:"5px"},children:"标签"}),(0,o.jsx)(l.Text,{children:"这是标题这是标题这是标题这是标题这是标题"})]}),(0,o.jsxs)(l.View,{className:"down",children:[(0,o.jsxs)(l.View,{className:"date",children:[(0,o.jsx)(l.View,{className:"21",children:"莲花山公园"}),(0,o.jsx)(l.View,{className:"11",children:"2022年11月17日"})]}),(0,o.jsx)(l.View,{className:"btn",children:(0,o.jsx)(s.default,{plain:!0,hairline:!0,type:"primary",children:"立即报名"})})]})]})]})}},"./src/pages/components/TabbarCom/index.tsx":function(e,n,a){var s=a("./node_modules/@antmjs/vantui/es/tabbar/index.js"),t=a("./node_modules/@antmjs/vantui/es/tabbar-item/index.js"),i=a("./node_modules/@babel/runtime/helpers/esm/slicedToArray.js"),l=a("./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js"),o=a("webpack/container/remote/@tarojs/taro"),d=a.n(o),r=a("webpack/container/remote/react"),c=a.n(r),u=a("webpack/container/remote/react/jsx-runtime");n.default=function TabbarCom(e){var n,a=c().useState(null!==(n=null==e?void 0:e.active)&&void 0!==n?n:0),o=(0,i.default)(a,2),r=o[0],m=o[1];return(0,u.jsx)(l.View,{style:{marginTop:"40px"},children:(0,u.jsxs)(s.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)&&d().redirectTo({url:"/pages/home/index"}),1===(null==e?void 0:e.detail)&&d().redirectTo({url:"/pages/activityList/index"}),2===(null==e?void 0:e.detail)&&d().redirectTo({url:"/pages/my/index"})},safeAreaInsetBottom:!0,children:[(0,u.jsx)(t.default,{icon:"home-o",children:"首页"}),(0,u.jsx)(t.default,{icon:"friends-o",children:"活动"}),(0,u.jsx)(t.default,{icon:"setting-o",children:"我的"})]})})}},"./src/utils/index.ts":function(e,n,a){a.d(n,{getTable:function(){return i}});var s=a("webpack/container/remote/@tarojs/taro"),t=a.n(s),i=function getTable(e){var n=e.env,a=e.tableName,s=e.okFun,i=t().cloud.database({env:n}),l=null==i?void 0:i.collection(a);null==l||l.get({success:function success(e){s(e)}})}}}]);
|
||||
"use strict";(wx.webpackJsonp=wx.webpackJsonp||[]).push([["common"],{"./src/pages/components/ActiveCard/index.tsx":function(e,n,a){var t=a("./node_modules/@antmjs/vantui/es/button/index.js"),s=a("./node_modules/@antmjs/vantui/es/image/index.js"),i=a("./node_modules/@antmjs/vantui/es/tag/index.js"),l=a("./node_modules/@babel/runtime/helpers/esm/slicedToArray.js"),o=a("./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js"),d=a("webpack/container/remote/react"),c=a("webpack/container/remote/react/jsx-runtime");n.default=function ActiveCard(e){var n=(0,d.useState)({}),a=(0,l.default)(n,2),r=(a[0],a[1],null==e?void 0:e.dataSource),u=r.title,m=r.address,x=r.date,j=r.tagName,p=(r.tagCode,r.Status),v=r.images;r.isDelete;return(0,c.jsxs)(o.View,{className:"activeCard",children:[(0,c.jsxs)(o.View,{className:"left",children:[!1,(0,c.jsx)(o.View,{className:"leftImage",children:(0,c.jsx)(s.default,{width:"100%",height:"100px",fit:"cover",src:null==v?void 0:v[0]})})]}),(0,c.jsxs)(o.View,{className:"middle",children:[(0,c.jsxs)(o.View,{className:"title",children:[(0,c.jsx)(i.default,{round:!0,type:"warning",style:{marginRight:"5px"},children:j}),(0,c.jsx)(o.Text,{children:u})]}),(0,c.jsxs)(o.View,{className:"down",children:[(0,c.jsxs)(o.View,{className:"date",children:[(0,c.jsx)(o.View,{className:"21",children:m}),(0,c.jsx)(o.View,{className:"11",children:x})]}),(0,c.jsx)(o.View,{className:"btn",children:(0,c.jsx)(t.default,{plain:!0,hairline:!0,type:"primary",children:"0"===p?"立即报名":"取消"})})]})]})]})}},"./src/pages/components/TabbarCom/index.tsx":function(e,n,a){var t=a("./node_modules/@antmjs/vantui/es/tabbar/index.js"),s=a("./node_modules/@antmjs/vantui/es/tabbar-item/index.js"),i=a("./node_modules/@babel/runtime/helpers/esm/slicedToArray.js"),l=a("./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js"),o=a("webpack/container/remote/@tarojs/taro"),d=a.n(o),c=a("webpack/container/remote/react"),r=a.n(c),u=a("webpack/container/remote/react/jsx-runtime");n.default=function TabbarCom(e){var n,a=r().useState(null!==(n=null==e?void 0:e.active)&&void 0!==n?n:0),o=(0,i.default)(a,2),c=o[0],m=o[1];return(0,u.jsx)(l.View,{style:{marginTop:"40px"},children:(0,u.jsxs)(t.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)&&d().redirectTo({url:"/pages/home/index"}),1===(null==e?void 0:e.detail)&&d().redirectTo({url:"/pages/activityList/index"}),2===(null==e?void 0:e.detail)&&d().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,a){a.d(n,{getTable:function(){return i},getTableid:function(){return l}});var t=a("webpack/container/remote/@tarojs/taro"),s=a.n(t),i=function getTable(e){var n=e.env,a=e.tableName,t=e.okFun,i=s().cloud.database({env:n}),l=null==i?void 0:i.collection(a);null==l||l.get({success:function success(e){t(e)}})},l=function getTableid(e){var n=e.env,a=e.tableName,t=e.id,i=e.okFun,l=s().cloud.database({env:n}),o=null==l?void 0:l.collection(a);null==o||o.doc(t).get({success:function success(e){i(e)}})}}}]);
|
||||
@@ -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 s=n("./node_modules/@antmjs/vantui/es/button/index.js"),i=n("./node_modules/@antmjs/vantui/es/cell/index.js"),a=n("./node_modules/@antmjs/vantui/es/image/index.js"),o=n("./node_modules/@babel/runtime/helpers/esm/slicedToArray.js"),c=n("./node_modules/@tarojs/plugin-platform-weapp/dist/components-react.js"),l=n("webpack/container/remote/@tarojs/taro"),d=n.n(l),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=(0,r.useState)([]),n=(0,o.default)(t,2),l=n[0],p=n[1],x=(0,r.useState)(0),j=(0,o.default)(x,2),f=j[0],v=j[1];return(0,r.useEffect)((function(){}),[]),(0,r.useEffect)((function(){var e,t=d().getSystemInfoSync(),n=t.screenHeight,s=t.safeArea,i=void 0===s?{}:s,a=null!==(e=n-(null==i?void 0:i.bottom))&&void 0!==e?e:0;v(a);var o={tableName:"cityNew",id:"80516fb66370bcf300b8f43c5f4dd52b",okFun:function okFun(e){var t;console.log("res",e),p(null!==(t=null==e?void 0:e.data)&&void 0!==t?t:[])}};(0,u.getTable)(o)}),[]),(0,m.jsxs)(c.View,{className:"detailContent",children:[(0,m.jsxs)(c.View,{children:[(0,m.jsx)(c.View,{children:"活动标题活动标题活动标题活动标题活动标题活动标题活动标题"}),(0,m.jsx)(a.default,{width:"100%",height:"180px",fit:"cover",src:"https://img.yzcdn.cn/vant/cat.jpeg"}),(0,m.jsxs)(c.View,{children:[(0,m.jsx)(i.default,{isLink:!0,icon:"clock",title:"2022年11月22日",linkType:"navigateTo",url:"/pages/dashboard/index"}),(0,m.jsx)(i.default,{isLink:!0,icon:"location",title:"广东省深圳市龙华区你好",linkType:"navigateTo",url:"/pages/dashboard/index"})]}),(0,m.jsx)(c.View,{className:"imagesArr",children:[1,2,3,4].map((function(e){return(0,m.jsx)(a.default,{round:!0,width:"30px",height:"30px",src:"https://img.yzcdn.cn/vant/cat.jpeg",style:{marginRight:"5px"}})}))})]}),(0,m.jsx)(c.View,{onClick:function onClick(){},className:"RichText",children:(0,m.jsx)(c.RichText,{nodes:null==l||null===(e=l[0])||void 0===e?void 0:e.richText})}),(0,m.jsx)(c.View,{className:"detailBtn",style:{bottom:"".concat(null!=f?f:0,"px")},children:(0,m.jsx)(s.default,{type:"primary",block:!0,children:"立即参加"})})]})}},"./src/pages/activityList/components/details/index.tsx":function(e,t,n){var s=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,s.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 i=n("./node_modules/@antmjs/vantui/es/button/index.js"),s=n("./node_modules/@antmjs/vantui/es/cell/index.js"),a=n("./node_modules/@antmjs/vantui/es/image/index.js"),o=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,p=(0,r.useState)([]),x=(0,o.default)(p,2),j=x[0],v=x[1],g=(0,r.useState)(0),f=(0,o.default)(g,2),h=f[0],b=f[1],w=(0,d.getCurrentInstance)(),y=(null!==(e=null==w||null===(t=w.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,a=null!==(e=n-(null==s?void 0:s.bottom))&&void 0!==e?e:0;b(a);var o={tableName:"details",id:y,okFun:function okFun(e){var t;console.log("res",e),v(null!==(t=null==e?void 0:e.data)&&void 0!==t?t:[])}};(0,u.getTableid)(o)}),[]),(0,m.jsxs)(l.View,{className:"detailContent",children:[(0,m.jsxs)(l.View,{children:[(0,m.jsx)(l.View,{children:"活动标题活动标题活动标题活动标题活动标题活动标题活动标题"}),(0,m.jsx)(a.default,{width:"100%",height:"180px",fit:"cover",src:"https://img.yzcdn.cn/vant/cat.jpeg"}),(0,m.jsxs)(l.View,{children:[(0,m.jsx)(s.default,{isLink:!0,icon:"clock",title:"2022年11月22日",linkType:"navigateTo",url:"/pages/dashboard/index"}),(0,m.jsx)(s.default,{isLink:!0,icon:"location",title:"广东省深圳市龙华区你好",linkType:"navigateTo",url:"/pages/dashboard/index"})]}),(0,m.jsx)(l.View,{className:"imagesArr",children:[1,2,3,4].map((function(e){return(0,m.jsx)(a.default,{round:!0,width:"30px",height:"30px",src:"https://img.yzcdn.cn/vant/cat.jpeg",style:{marginRight:"5px"}})}))})]}),(0,m.jsx)(l.View,{onClick:function onClick(){},className:"RichText",children:(0,m.jsx)(l.RichText,{nodes:null==j||null===(n=j[0])||void 0===n?void 0:n.richText})}),(0,m.jsx)(l.View,{className:"detailBtn",style:{bottom:"".concat(null!=h?h: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()}]);
|
||||
2
dist/pages/home/index.js
vendored
2
dist/pages/home/index.js
vendored
File diff suppressed because one or more lines are too long
2
dist/pages/home/index.js.LICENSE.txt
vendored
2
dist/pages/home/index.js.LICENSE.txt
vendored
@@ -6,6 +6,8 @@
|
||||
|
||||
/*! ../../../node_modules/thread-loader/dist/cjs.js!../../../node_modules/babel-loader/lib/index.js??ruleSet[1].rules[9].use[1]!./index.tsx */
|
||||
|
||||
/*! ../../utils/index */
|
||||
|
||||
/*! ../common/jumpLink */
|
||||
|
||||
/*! ../common/utils */
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
import { Button, Cell } from "@antmjs/vantui";
|
||||
import { RichText, View } from "@tarojs/components";
|
||||
import Taro from "@tarojs/taro";
|
||||
import Taro, { getCurrentInstance } from "@tarojs/taro";
|
||||
import react, { useEffect, useState } from "react";
|
||||
import { getTable } from "../../../../utils/index";
|
||||
import { getTable, getTableid } from "../../../../utils/index";
|
||||
import "./index.scss";
|
||||
import { Image } from "@antmjs/vantui";
|
||||
|
||||
const details = () => {
|
||||
const [dataSource, setdataSource] = useState<any>([]);
|
||||
const [bottomheight, setbottomheight] = useState(0);
|
||||
let $instance: any = getCurrentInstance();
|
||||
const { id } = $instance?.router?.params??{}; //活动id
|
||||
|
||||
useEffect(() => {
|
||||
// 设置标题
|
||||
@@ -24,15 +26,15 @@ const details = () => {
|
||||
setbottomheight(newBottom);
|
||||
|
||||
let objParams = {
|
||||
tableName: "cityNew",
|
||||
id: "80516fb66370bcf300b8f43c5f4dd52b",
|
||||
tableName: "details",
|
||||
id: id,
|
||||
okFun: (res) => {
|
||||
console.log("res", res);
|
||||
setdataSource(res?.data ?? []);
|
||||
},
|
||||
};
|
||||
// getTable(objParams)
|
||||
getTable(objParams);
|
||||
getTableid(objParams) //指定活动详情id
|
||||
// getTable(objParams);
|
||||
}, []);
|
||||
|
||||
// console.log('SafeAreaResult',Taro.getSystemInfoSync())
|
||||
@@ -65,7 +67,7 @@ const details = () => {
|
||||
</View>
|
||||
|
||||
{/* 头像列表 */}
|
||||
<View className="imagesArr">
|
||||
<View className="imagesArr">
|
||||
{[1, 2, 3, 4].map((item: any) => {
|
||||
return (
|
||||
<Image
|
||||
@@ -73,13 +75,11 @@ const details = () => {
|
||||
width="30px"
|
||||
height="30px"
|
||||
src="https://img.yzcdn.cn/vant/cat.jpeg"
|
||||
style={{marginRight:'5px'}}
|
||||
style={{ marginRight: "5px" }}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</View>
|
||||
|
||||
|
||||
</View>
|
||||
{/* 富文本 */}
|
||||
<View onClick={() => {}} className="RichText">
|
||||
|
||||
@@ -1,46 +1,59 @@
|
||||
import { Button, Tabbar, TabbarItem } from "@antmjs/vantui";
|
||||
import { View, Text } from "@tarojs/components";
|
||||
import Taro from "@tarojs/taro";
|
||||
import react from "react";
|
||||
import react, { useState } from "react";
|
||||
import { Image } from "@antmjs/vantui";
|
||||
import "./index.scss";
|
||||
import { Tag } from "@antmjs/vantui";
|
||||
|
||||
const ActiveCard = () => {
|
||||
const ActiveCard = (props: any) => {
|
||||
const [dataSource, setdataSource] = useState<any>({}); //活动详情
|
||||
const { title, address, date, tagName, tagCode, Status, images, isDelete } =
|
||||
props?.dataSource;
|
||||
|
||||
return (
|
||||
<View className="activeCard">
|
||||
<View className="left">
|
||||
{false && <View className="leftTag">
|
||||
<Tag round={true} type="success">
|
||||
标签
|
||||
</Tag>
|
||||
</View>}
|
||||
{false && (
|
||||
<View className="leftTag">
|
||||
<Tag round={true} type="success">
|
||||
标签
|
||||
</Tag>
|
||||
</View>
|
||||
)}
|
||||
|
||||
<View className="leftImage">
|
||||
<Image
|
||||
width="100%"
|
||||
height="100px"
|
||||
fit="cover"
|
||||
src="cloud://cloud1-5g5xrgza12a0dd6d.636c-cloud1-5g5xrgza12a0dd6d-1253665791/images/v4-460px-Climb-a-Mountain-Step-9.jpg"
|
||||
// src="cloud://cloud1-5g5xrgza12a0dd6d.636c-cloud1-5g5xrgza12a0dd6d-1253665791/images/v4-460px-Climb-a-Mountain-Step-9.jpg"
|
||||
src={images?.[0]}
|
||||
/>
|
||||
</View>
|
||||
</View>
|
||||
<View className="middle">
|
||||
<View className="title">
|
||||
<Tag round={true} type="warning" style={{ marginRight: "5px" }}>
|
||||
标签
|
||||
{/* 标签 */}
|
||||
{tagName}
|
||||
</Tag>
|
||||
<Text>这是标题这是标题这是标题这是标题这是标题</Text>
|
||||
|
||||
{/* 标题 */}
|
||||
<Text>{title}</Text>
|
||||
</View>
|
||||
<View className="down">
|
||||
<View className="date">
|
||||
<View className="21">莲花山公园</View>
|
||||
<View className="11">2022年11月17日</View>
|
||||
{/* 地址 */}
|
||||
<View className="21">{address}</View>
|
||||
{/* 日期 */}
|
||||
<View className="11">{date}</View>
|
||||
</View>
|
||||
|
||||
<View className="btn">
|
||||
{/* 活动状态 0 待开放 1开放中 2已取消 3进行中 4已结束 5已关闭 */}
|
||||
<Button plain hairline type="primary">
|
||||
立即报名
|
||||
{Status === "0" ? "立即报名" : "取消"}
|
||||
</Button>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
@@ -35,6 +35,8 @@ const Home = () => {
|
||||
|
||||
const [SearchValue, setSearchValue] = useState("");
|
||||
|
||||
const [details,setdetails]=useState<any>([]) //活动详情
|
||||
|
||||
const onChange = (e) => {};
|
||||
const images = [
|
||||
"cloud://cloud1-5g5xrgza12a0dd6d.636c-cloud1-5g5xrgza12a0dd6d-1253665791/download.jpg",
|
||||
@@ -55,15 +57,18 @@ const Home = () => {
|
||||
withShareTicket: true,
|
||||
success() {},
|
||||
});
|
||||
// let objParams = {
|
||||
// tableName: "test",
|
||||
// id: "80516fb66370bcf300b8f43c5f4dd52b",
|
||||
// okFun: (res) => {
|
||||
// console.log("res", res);
|
||||
// },
|
||||
// };
|
||||
|
||||
// getTableid(objParams);
|
||||
|
||||
let objParams = {
|
||||
tableName: "details",
|
||||
// id: "80516fb66370bcf300b8f43c5f4dd52b",
|
||||
okFun: (res) => {
|
||||
console.log("details--", res);
|
||||
setdetails(res?.data??[])
|
||||
},
|
||||
};
|
||||
|
||||
getTable(objParams);
|
||||
}, []);
|
||||
|
||||
const uploadTaro = (tempFilePaths: any) => {
|
||||
@@ -300,26 +305,18 @@ const Home = () => {
|
||||
</View> */}
|
||||
|
||||
{/* 截取数组2个活动 */}
|
||||
{[1, 2, 3, 4].splice(0, 2).map((item: any) => {
|
||||
{details.splice(0, 2).map((item: any,index:any) => {
|
||||
return (
|
||||
<View
|
||||
onClick={() => {
|
||||
console.log("Card");
|
||||
Taro.navigateTo({
|
||||
url: "/pages/activityList/components/details/index",
|
||||
url: `/pages/activityList/components/details/index?id=${item?._id}`,
|
||||
});
|
||||
}}
|
||||
>
|
||||
{/* 活动卡片 */}
|
||||
<ActiveCard />
|
||||
|
||||
{/* <Card
|
||||
num=""
|
||||
price=""
|
||||
desc="报名中"
|
||||
title="周末爬山"
|
||||
thumb="cloud://cloud1-5g5xrgza12a0dd6d.636c-cloud1-5g5xrgza12a0dd6d-1253665791/images.jpg"
|
||||
/> */}
|
||||
<ActiveCard dataSource={item} />
|
||||
</View>
|
||||
);
|
||||
})}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import Taro from "@tarojs/taro";
|
||||
import { getCurrentInstance } from "@tarojs/taro";
|
||||
|
||||
|
||||
// 数据库环境
|
||||
// const db: any = Taro.cloud.database({
|
||||
@@ -13,6 +15,10 @@ interface Typeint {
|
||||
okFun: any;
|
||||
}
|
||||
|
||||
const params=()=>{
|
||||
let $instance: any = getCurrentInstance();
|
||||
return $instance.router.params;
|
||||
}
|
||||
// 添加数据
|
||||
export const addTable: any = ({ env,tableName, objData, okFun }: Typeint) => {
|
||||
// 数据库环境
|
||||
@@ -30,7 +36,7 @@ export const addTable: any = ({ env,tableName, objData, okFun }: Typeint) => {
|
||||
});
|
||||
};
|
||||
|
||||
// 获取指定集合数据
|
||||
// 获取指定集合数据表
|
||||
export const getTable: any = ({ env,tableName, okFun }: Typeint) => {
|
||||
// 数据库环境
|
||||
const db: any = Taro.cloud.database({
|
||||
@@ -45,6 +51,24 @@ export const getTable: any = ({ env,tableName, okFun }: Typeint) => {
|
||||
});
|
||||
};
|
||||
|
||||
// 获取指定id数据数据
|
||||
export const getTableid: any = ({ env,tableName, id, okFun }: Typeint) => {
|
||||
// 数据库环境
|
||||
const db: any = Taro.cloud.database({
|
||||
env: env,
|
||||
});
|
||||
|
||||
let nowtable: any = db?.collection(tableName);
|
||||
nowtable?.doc(id).get({
|
||||
success: (res: any) => {
|
||||
okFun(res);
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
// 更新数据
|
||||
export const updateTableid: any = ({ env,tableName,objData, id, okFun }: Typeint) => {
|
||||
// 数据库环境
|
||||
@@ -77,17 +101,3 @@ export const deleteTableid: any = ({ env,tableName, id, okFun }: Typeint) => {
|
||||
|
||||
|
||||
|
||||
// 获取指定id数据数据
|
||||
export const getTableid: any = ({ env,tableName, id, okFun }: Typeint) => {
|
||||
// 数据库环境
|
||||
const db: any = Taro.cloud.database({
|
||||
env: env,
|
||||
});
|
||||
|
||||
let nowtable: any = db?.collection(tableName);
|
||||
nowtable?.doc(id).get({
|
||||
success: (res: any) => {
|
||||
okFun(res);
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user