feat: 数组排序reverse

This commit is contained in:
eric
2022-11-26 12:01:33 +08:00
parent 91b15419af
commit 0555fb9392
5 changed files with 75 additions and 25 deletions

8
dist/base.wxml vendored
View File

@@ -129,6 +129,14 @@
</video> </video>
</template> </template>
<template name="tmpl_0_59">
<web-view src="{{i.p0}}" bindmessage="eh" bindload="eh" binderror="eh" style="{{i.st}}" class="{{i.cl}}" bindtap="eh" id="{{i.uid||i.sid}}" data-sid="{{i.sid}}">
<block wx:for="{{i.cn}}" wx:key="sid">
<template is="{{xs.e(cid+1)}}" data="{{i:item,l:l}}" />
</block>
</web-view>
</template>
<template name="tmpl_0_36"> <template name="tmpl_0_36">
<official-account bindload="eh" binderror="eh" style="{{i.st}}" class="{{i.cl}}" bindtap="eh" id="{{i.uid||i.sid}}" data-sid="{{i.sid}}"></official-account> <official-account bindload="eh" binderror="eh" style="{{i.st}}" class="{{i.cl}}" bindtap="eh" id="{{i.uid||i.sid}}" data-sid="{{i.sid}}"></official-account>
</template> </template>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,6 +1,6 @@
import { Button, Cell, Toast } from "@antmjs/vantui"; import { Button, Cell, Toast } from "@antmjs/vantui";
import { RichText, View } from "@tarojs/components"; import { RichText, View } from "@tarojs/components";
import Taro, { getCurrentInstance } from "@tarojs/taro"; import Taro, { getCurrentInstance, useShareTimeline } from "@tarojs/taro";
import react, { useEffect, useState } from "react"; import react, { useEffect, useState } from "react";
import { import {
addTable, addTable,
@@ -30,6 +30,27 @@ const details = () => {
}); });
}, []); }, []);
// 分享到朋友圈
useShareTimeline(() => {
return {
title: "分享朋友圈", //字符串 自定义标题
// query: `id=${this.data.shop.shop_id}`, //页面携带参数
// imageUrl: moments //图片地址
};
});
useEffect(() => {
// 设置允许分享
Taro.showShareMenu({
withShareTicket: true,
});
// 其他分享
Taro.updateShareMenu({
withShareTicket: true,
success() {},
});
}, []);
useEffect(() => { useEffect(() => {
// (dataSource?.useridArr ?? []).length > 0 && // (dataSource?.useridArr ?? []).length > 0 &&
Taro.cloud.callFunction({ Taro.cloud.callFunction({
@@ -55,17 +76,22 @@ const details = () => {
let newBottom = screenHeight - safeArea?.bottom ?? 0; let newBottom = screenHeight - safeArea?.bottom ?? 0;
setbottomheight(newBottom); setbottomheight(newBottom);
getDetail();
}, []);
// 获取详情
const getDetail = () => {
let objParams = { let objParams = {
tableName: "details", tableName: "details",
id: id, id: id,
okFun: (res) => { okFun: (res) => {
console.log("res", res); console.log("res", res);
setdataSource(res?.data ?? []); setdataSource((res?.data ?? []));
}, },
}; };
getTableid(objParams); //指定活动详情id getTableid(objParams); //指定活动详情id
// getTable(objParams); // getTable(objParams)
}, []); };
// console.log('SafeAreaResult',Taro.getSystemInfoSync()) // console.log('SafeAreaResult',Taro.getSystemInfoSync())
@@ -220,11 +246,13 @@ const details = () => {
message: "取消成功", message: "取消成功",
selector: "#vanToast-demo2", selector: "#vanToast-demo2",
onClose: () => { onClose: () => {
// 刷新数据
getDetail();
// 返回首页 [上一页] // 返回首页 [上一页]
Taro.navigateBack({ // Taro.navigateBack({
// url: "/pages/home/index", // // url: "/pages/home/index",
delta: 1, // delta: 1,
}); // });
}, },
}); });
}, },
@@ -266,11 +294,14 @@ const details = () => {
message: "报名成功", message: "报名成功",
selector: "#vanToast-demo2", selector: "#vanToast-demo2",
onClose: () => { onClose: () => {
// 刷新数据
getDetail();
// 返回首页 [上一页] // 返回首页 [上一页]
Taro.navigateBack({ // Taro.navigateBack({
// url: "/pages/home/index", // // url: "/pages/home/index",
delta: 1, // delta: 1,
}); // });
}, },
}); });
}, },

View File

@@ -11,7 +11,7 @@ import {
Tag, Tag,
Toast, Toast,
} from "@antmjs/vantui"; } from "@antmjs/vantui";
import { Input, OfficialAccount, View } from "@tarojs/components"; import { Input, OfficialAccount, View, WebView } from "@tarojs/components";
import React, { useCallback, useEffect, useState } from "react"; import React, { useCallback, useEffect, useState } from "react";
import { Swiper, SwiperItem, Image } from "@antmjs/vantui"; import { Swiper, SwiperItem, Image } from "@antmjs/vantui";
import react from "react"; import react from "react";
@@ -130,7 +130,7 @@ const Home = () => {
}; };
// 上传到云存储 // 上传到云存储
const uploadTaro = (tempFilePaths: any,lbsInfo:any) => { const uploadTaro = (tempFilePaths: any, lbsInfo: any) => {
// 云开发存储文件 [/自动创建文件路径] // 云开发存储文件 [/自动创建文件路径]
Taro.cloud.uploadFile({ Taro.cloud.uploadFile({
cloudPath: `images/checkIn/${new Date()?.getTime()}.png`, cloudPath: `images/checkIn/${new Date()?.getTime()}.png`,
@@ -138,7 +138,7 @@ const Home = () => {
success: (res: any) => { success: (res: any) => {
// get resource ID // get resource ID
console.log("res", res?.fileID); console.log("res", res?.fileID);
checkIn({ imageUrl: res?.fileID,lbsInfo: lbsInfo}); checkIn({ imageUrl: res?.fileID, lbsInfo: lbsInfo });
// 跳转到目的页面,打开新页面 // 跳转到目的页面,打开新页面
// Taro.navigateTo({ // Taro.navigateTo({
@@ -168,7 +168,7 @@ const Home = () => {
// 签到 // 签到
const checkIn = async (data: any) => { const checkIn = async (data: any) => {
console.log('data=====',data) console.log("data=====", data);
let postData = { let postData = {
tableName: "userInfo", tableName: "userInfo",
keyValue: { openId: openid }, keyValue: { openId: openid },
@@ -184,8 +184,8 @@ const Home = () => {
{ {
imageUrl: data?.imageUrl, imageUrl: data?.imageUrl,
checkTime: new Date().valueOf(), //打卡时间 checkTime: new Date().valueOf(), //打卡时间
latitude:data?.lbsInfo?.latitude, latitude: data?.lbsInfo?.latitude,
longitude:data?.lbsInfo?.longitude longitude: data?.lbsInfo?.longitude,
// remark: fieldValues?.remark, // remark: fieldValues?.remark,
// location: address, // location: address,
}, },
@@ -231,7 +231,7 @@ const Home = () => {
}); });
}; };
const chooseImage = (lbsInfo:any) => { const chooseImage = (lbsInfo: any) => {
// 相机拍照 // 相机拍照
Taro.chooseImage({ Taro.chooseImage({
count: 1, // 默认9 count: 1, // 默认9
@@ -248,7 +248,7 @@ const Home = () => {
// url: `/pages/home/components/CheckIn/index?fileID=${tempFilePaths?.[0]}`, // url: `/pages/home/components/CheckIn/index?fileID=${tempFilePaths?.[0]}`,
// }); // });
uploadTaro(tempFilePaths,lbsInfo); uploadTaro(tempFilePaths, lbsInfo);
}, },
complete: () => { complete: () => {
// 刷新页面数据 // 刷新页面数据
@@ -392,12 +392,12 @@ const Home = () => {
// 拍照上传 // 拍照上传
chooseImage(lbsInfo); chooseImage(lbsInfo);
}, },
fail:()=>{ fail: () => {
Toast.fail({ Toast.fail({
message: "定位授权异常,无法签到打卡", message: "定位授权异常,无法签到打卡",
selector: "#vanToast-demo2", selector: "#vanToast-demo2",
}); });
} },
}); });
// chooseImage(); // chooseImage();
} else { } else {
@@ -489,7 +489,7 @@ const Home = () => {
{/* 截取数组2个活动 */} {/* 截取数组2个活动 */}
{details?.length > 0 && ( {details?.length > 0 && (
<View> <View>
{(details?.splice(0, 2) ?? []).map((item: any, index: any) => { {(details?.reverse()?.splice(0, 2) ?? []).map((item: any, index: any) => {
return ( return (
<View <View
onClick={() => { onClick={() => {
@@ -545,6 +545,17 @@ const Home = () => {
打开视频号主页 打开视频号主页
</View> */} </View> */}
{/* 个人小程序无法打开公众号文章 */}
{/* <WebView src="https://mp.weixin.qq.com/s/LkjkAWW9VUB90KoyZpI5Fg" onMessage={() => {}} /> */}
<View onClick={()=>{
Taro.requestSubscribeMessage({
tmplIds:["oyY-sN3yBm4JRch1PoT-Cj7049c9vyZAMs1LwnUma4I"], //模板id
success:(res:any)=>{
console.log('res',res)
}
})
}}>订阅消息</View>
<Toast id="vanToast-demo2" /> <Toast id="vanToast-demo2" />
<TabbarCom active={0} /> <TabbarCom active={0} />