add:UI设计稿修复,以及确定后续使用的taro图表库为@visactor/taro-vchart

master
blak-kong 2 years ago
parent bf179ffb7c
commit db13090485

62108
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -54,6 +54,8 @@
"@tarojs/runtime": "3.6.19",
"@tarojs/shared": "3.6.19",
"@tarojs/taro": "3.6.19",
"@visactor/taro-vchart": "^1.9.0",
"dayjs": "^1.11.10",
"lodash": "^4.17.15",
"react": "^18.0.0",
"react-dom": "^18.0.0",

@ -164,7 +164,7 @@
}
// 折叠高度
.main__body.main__body--isFolding {
height: 90px;
height: 80px;
}
}
/* 样式定制 */

@ -25,8 +25,9 @@
justify-content: space-between;
align-items: center;
background: #fff;
// padding-bottom: 10rpx;
border: 0;
z-index: 99;
padding-bottom: 2rpx;
.logo {
display: inline-flex;
align-items: center;

@ -1,9 +1,12 @@
.common-box {
.drawer-box {
padding: 38rpx 0 0;
// padding-bottom: 40rpx;
box-sizing: border-box;
z-index: 100005;
.drawer-popup-title {
margin-bottom: 60rpx;
}
}
.common-popup-content-box {
margin-top: 42rpx;
}

@ -79,10 +79,18 @@ export default class PopupDrawer extends Component<any, any> {
></View>
)}
<View
className={classnames("common-box", "common-big-large")}
className={classnames(
"common-box",
"drawer-box",
"common-big-large"
)}
style="margin: auto;"
>
<View className="common-popup-title">{title}</View>
<View
className={classnames("common-popup-title", "drawer-popup-title")}
>
{title}
</View>
<View className="common-popup-content-box">
<View
className={classnames("common-popup-content", {

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

@ -120,6 +120,8 @@ page {
height: 474rpx;
background: linear-gradient(0deg, #f8f8f8 0%, #efefef 100%);
border-radius: 50rpx;
padding-bottom: env(safe-area-inset-bottom);
box-sizing: border-box;
.text {
font-size: 48rpx;
font-family: PingFang SC;
@ -132,7 +134,7 @@ page {
font-size: 26rpx;
font-weight: 400;
color: #666;
margin-top: 48rpx;
margin-top: 40rpx;
}
.indicator {
display: inline-flex;
@ -140,7 +142,7 @@ page {
width: 360rpx;
height: 2rpx;
background: transparent;
margin-top: 229rpx;
margin-top: 200rpx;
.dot {
display: inline-flex;
flex: 1;

@ -215,7 +215,7 @@ class Entry extends Component<any, any> {
<View
key={"indicator_" + index}
className={classnames("dot", {
"bg-show": current >= index,
"bg-show": current === index,
})}
></View>
);

@ -2,6 +2,11 @@ page {
background: #f3f3f3;
}
// .index-main {
// height: max-content;
// background: #f3f3f3;
// }
/* 隐藏横向滚动条 */
::-webkit-scrollbar {
width: 0;
@ -1002,6 +1007,7 @@ page {
align-items: center;
justify-content: space-between;
height: 40rpx;
z-index: 99;
.text {
color: #666;
font-size: 26rpx;

@ -13,7 +13,7 @@ import {
/*** redux ***/
import { connect } from "react-redux";
import { userRefresh } from "../../store/features/userInfo";
import { userRefresh, tokenRefresh } from "../../store/features/userInfo";
import { setIndexFlag } from "../../store/features/globalStore";
/*** redux end ***/
@ -356,14 +356,9 @@ class Index extends Component<any, any> {
const { code } = await Taro.login();
const { data } = await WCUserLogin({ code });
if (data.code === 200) {
setStorageSync("isWelcome", "true");
setStorageSync(
"token",
data.data.token,
dayjs().add(12, "h").format("YYYY/MM/DD hh:mm:ss")
);
Taro.setStorageSync("isWelcome", true);
Taro.setStorageSync("mobile", data.data.mobile);
this.props.userRefresh(data.data);
this.props.tokenRefresh(data.data);
Taro.hideLoading();
this.initPageData();
@ -384,8 +379,6 @@ class Index extends Component<any, any> {
if (url) {
let urlObj = new URL(url);
let params = new URLSearchParams(url);
console.log("urlObj", urlObj);
console.log("params", params);
let { data } = await InstrumentInfo.getInstrumentInfoBySerial();
console.log("Data", data);
}
@ -412,7 +405,6 @@ class Index extends Component<any, any> {
typeBinding,
} = this.state;
console.log("bannerList", bannerList);
return (
<Block>
<PopupAlert
@ -610,6 +602,9 @@ const mapDispatchToProps = (dispatch) => ({
userRefresh(data) {
dispatch(userRefresh(data));
},
tokenRefresh(data) {
dispatch(tokenRefresh(data));
},
setIndexFlag(data) {
dispatch(setIndexFlag(data));
},

@ -32,7 +32,7 @@
align-items: center;
// justify-content: center;
// left: 50%;
bottom: calc(env(safe-area-inset-bottom) + 142rpx);
bottom: 142rpx;
// transform: translateX(-50%);
}

@ -1,3 +1,4 @@
import dayjs from "dayjs";
import { MpSplashDetail, WCUserLogin } from "../../utils/Interface";
import { Component, PropsWithChildren, useEffect, useState } from "react";
import Taro from "@tarojs/taro";
@ -16,12 +17,12 @@ import Navbar from "../../components/navbar/navbar";
/*** redux ***/
import { connect } from "react-redux";
import { userRefresh } from "../../store/features/userInfo";
import { userRefresh, tokenRefresh } from "../../store/features/userInfo";
/*** redux end ***/
import "taro-ui/dist/style/components/button.scss"; // 按需引入
import "./initiate.less";
import { go, msg } from "../../utils/traoAPI";
import { go, msg, setStorageSync, getStorageSync } from "../../utils/traoAPI";
class Initiate extends Component<any, any> {
constructor(props) {
@ -49,7 +50,7 @@ class Initiate extends Component<any, any> {
const menu = Taro.getMenuButtonBoundingClientRect();
this.setState({ menu });
if (!Taro.getStorageSync("token")) {
if (!getStorageSync("token")) {
await this.WCUserLogin();
} else {
go("/pages/entry/entry");
@ -117,12 +118,13 @@ class Initiate extends Component<any, any> {
const { data } = await WCUserLogin({ code });
if (data.code === 200) {
Taro.setStorageSync("isWelcome", true);
Taro.setStorageSync("token", data.data.token);
Taro.setStorageSync("mobile", data.data.mobile);
this.props.userRefresh(data.data);
this.props.tokenRefresh(data.data);
Taro.hideLoading();
setTimeout(() => {
this.initData();
}, 300);
} else {
msg("请求失败,尝试重新请求");
this.WCUserLogin();
@ -142,7 +144,7 @@ class Initiate extends Component<any, any> {
this.onEnded();
}
onEnded = () => {
let token = Taro.getStorageSync("token");
let token = getStorageSync("token");
if (token) {
let data = Taro.getStorageSync("MpSplashDetail_type1") || undefined;
if (data) {
@ -222,5 +224,8 @@ const mapDispatchToProps = (dispatch) => ({
userRefresh(value) {
dispatch(userRefresh(value));
},
tokenRefresh(value) {
dispatch(tokenRefresh(value));
},
});
export default connect(mapStateToProps, mapDispatchToProps)(Initiate);

@ -100,7 +100,7 @@ page {
.list_block {
width: 100%;
border-bottom: 2rpx solid #dddddd;
padding: 32rpx 0 30rpx 0;
padding: 32rpx 30rpx 30rpx 30rpx;
box-sizing: border-box;
}
.left {

@ -447,7 +447,7 @@ class IntegralList extends Component<any, any> {
scrollY={this.state.scrollY}
scrollWithAnimation
>
<View style={{ padding: "0 12px" }}>
<View>
<View>
{list.length === 0 && (
<View className="nodata">

@ -5,7 +5,7 @@ page {
background: #fff;
border-radius: 30rpx;
margin: 20rpx 30rpx 0;
padding: 20rpx 34rpx 48rpx;
padding: 20rpx 35rpx 48rpx 35rpx;
box-sizing: border-box;
.info1 {
.left {

@ -2,6 +2,10 @@
padding-bottom: 160rpx;
}*/
page {
background-color: #f8f8f8;
}
.tabs {
display: flex;
align-items: center;

@ -70,7 +70,7 @@ export default class Recording extends Component<any, any> {
<View className="nodata">
<Image
className="nodata_img"
src={require("../../img/empty.png")}
src={require("../../img/nodata.png")}
></Image>
<View className="nodata_text"></View>
</View>
@ -81,9 +81,9 @@ export default class Recording extends Component<any, any> {
<View className="nodata">
<Image
className="nodata_img"
src={require("../../img/empty.png")}
src={require("../../img/nodata.png")}
></Image>
<View className="empty_text"></View>
<View className="nodata_text"></View>
</View>
</View>
)}

@ -28,10 +28,10 @@ page {
.footer {
position: relative;
margin-top: -62rpx;
margin-top: -72rpx;
z-index: 1;
width: 100%;
height: 570rpx;
height: 580rpx;
background: #fff;
// background: #000;
border-radius: 50rpx 50rpx 0rpx 0rpx;
@ -71,7 +71,7 @@ page {
line-height: 90rpx;
font-size: 32rpx;
font-weight: bold;
margin: 118rpx auto 42rpx;
margin: 110rpx auto 36rpx;
text-align: center;
}

@ -22,7 +22,7 @@ page {
.infobox1 {
border-radius: 20rpx;
margin-top: 168rpx;
margin-top: 130rpx;
/*height: 490rpx;*/
}
.infobox1 .info1 {
@ -264,3 +264,7 @@ page {
border-radius: 50%;
}
}
.common-box {
padding: 50rpx 35rpx 44rpx 35rpx;
}

@ -14,7 +14,7 @@ import { userRefresh } from "../../store/features/userInfo";
import { RefreshWxUserInfo, GetNoReadMessageNum } from "../../utils/Interface";
import "taro-ui/dist/style/components/button.scss"; // 按需引入
// import "taro-ui/dist/style/components/button.scss"; // 按需引入
import "./user.less";
import type CustomTabBar from "../../custom-tab-bar";
@ -204,6 +204,7 @@ class User extends Component<any, any> {
/>
<PopupAlert
isShow={isNotRegister}
isClose={true}
title="提示"
content="暂未授权注册,请点击注册"
confirmButtonText="确定"

@ -41,7 +41,6 @@ class UserInfo extends Component<any, any> {
style: "font-size: 26rpx; font-weight: 400; color: #ccc",
userInfo: {
...this.props.userInfo,
birthday: "",
},
isShowIntegralText: false,
cityShow: false,
@ -80,7 +79,9 @@ class UserInfo extends Component<any, any> {
// maxDate: new Date().getTime(),
// minDate: new Date("1949-10-01").getTime(),
minDate: new Date("1949-10-01").getTime(),
birthday: dayjs(this.props.userInfo.birthday).valueOf(),
birthday: this.props.userInfo.birthday
? dayjs(this.props.userInfo.birthday).valueOf()
: dayjs().valueOf(),
isSubmit: false, // 是否允许提交
};
}

@ -83,6 +83,9 @@ class UserInfoDetail extends Component<any, any> {
// maxDate: new Date().getTime(),
// minDate: new Date("1949-10-01").getTime(),
currentDate: new Date().getTime(),
birthday: this.props.userInfo.birthday
? dayjs(this.props.userInfo.birthday).valueOf()
: dayjs().valueOf(),
minDate: new Date("1949-10-01").getTime(),
};
}
@ -400,6 +403,7 @@ class UserInfoDetail extends Component<any, any> {
minDate,
isShowIntegralText,
isSubmit,
birthday,
} = this.state;
const formatter = (type, value) => {
@ -491,7 +495,7 @@ class UserInfoDetail extends Component<any, any> {
<View className="value">
{/* <picker className="picker" mode="date" bindchange="bindbirthdayPickerChange" end="{{dateend}}" value="{{ageindex}}" range="{{age}}">picker</picker> */}
<View>{userInfo.birthday || dayjs().format("YYYY-MM-DD")}</View>
<View>{userInfo.birthday}</View>
<View className="righticon">
<Image
src={require("../../img/user/right.png")}
@ -529,7 +533,7 @@ class UserInfoDetail extends Component<any, any> {
<DatetimePicker
type="date"
formatter={formatter}
value={dayjs(userInfo.birthday).valueOf()}
value={dayjs(birthday).valueOf()}
minDate={minDate}
maxDate={Date.now()}
onCancel={this.onTimePickerCancel}

@ -2,6 +2,8 @@ import Taro from "@tarojs/taro";
import dayjs from "dayjs";
import { createSlice } from "@reduxjs/toolkit";
import { setStorageSync, getStorageSync } from "../../utils/traoAPI";
const userInfoReducer = createSlice({
name: "userInfo", // store的名字
initialState: {
@ -37,7 +39,7 @@ const userInfoReducer = createSlice({
state.mobile = payload.mobile || "";
state.nickname = payload.nickname || "";
state.headimg = payload.headimg || "";
state.birthday = payload.birthday || dayjs().format("YYYY-MM-DD");
state.birthday = payload.birthday || "";
state.province = payload.province || "";
state.provinceId = payload.provinceId || "";
state.city = payload.city || "";
@ -57,7 +59,7 @@ const userInfoReducer = createSlice({
state.mobile = payload.mobile || "";
state.nickname = payload.nickname || "";
state.headimg = payload.headimg || "";
state.birthday = payload.birthday || dayjs().format("YYYY-MM-DD");
state.birthday = payload.birthday || "";
state.province = payload.province || "";
state.provinceId = payload.provinceId || "";
state.city = payload.city || "";
@ -70,11 +72,13 @@ const userInfoReducer = createSlice({
state.integralText = payload.integralText || "";
Taro.setStorageSync("mobile", state.mobile);
Taro.setStorageSync("token", state.token);
let expires = new Date().getTime() + 43200000;
setStorageSync("token", state.token, expires);
},
},
});
export const { setMobile, setNickname, setHeadimg, userRefresh } =
export const { setMobile, setNickname, setHeadimg, userRefresh, tokenRefresh } =
userInfoReducer.actions;
export default userInfoReducer.reducer;

@ -1,7 +1,6 @@
import { back, showModal } from "./traoAPI";
import { back, showModal, setStorageSync, getStorageSync } from "./traoAPI";
import { WCUserLogin } from "./Interface";
import Taro from "@tarojs/taro";
import formdata from "./wxFormdata/formData";
import store from "../store";
@ -29,11 +28,12 @@ export const Ajax = (params) => {
requestUrlList.push(params.url);
}
return new Promise((reslove, reject) => {
let token = getStorageSync("token");
Taro.request({
url: domain + params.url,
method: params.method || "GET",
header: {
Authorization: "Bearer " + Taro.getStorageSync("token"),
Authorization: "Bearer " + token,
...params.header,
},
data: params.data,
@ -45,7 +45,7 @@ export const Ajax = (params) => {
content: "登录已过期,请重新登录",
showCancel: false,
}).then((res) => {
Taro.setStorageSync("token", null);
setStorageSync("token", null);
Taro.clearStorage(); // 清空所有缓存
Taro.reLaunch({
url: "/pages/initiate/initiate",
@ -82,7 +82,7 @@ export const Ajax = (params) => {
}).then(() => {
reject(res);
if (res.data.code == 401 || res.data.msg === "登录状态已过期") {
Taro.setStorageSync("token", null);
setStorageSync("token", null);
Taro.reLaunch({
url: "/pages/initiate/initiate",
});
@ -127,6 +127,7 @@ export const AjaxUploadFile = (params, formData) => {
mask: true,
});
return new Promise((reslove, reject) => {
let token = getStorageSync("token");
Taro.uploadFile({
filePath: params.filePath,
name: "file",
@ -135,9 +136,8 @@ export const AjaxUploadFile = (params, formData) => {
...formData,
},
header: {
Authorization: "Bearer " + Taro.getStorageSync("token"),
Authorization: "Bearer " + token,
...params.header,
// token: Taro.getStorageSync("token"),
},
success(res) {
let o = JSON.parse(res.data);
@ -191,11 +191,12 @@ export const AjaxFormData = (params) => {
requestUrlList.push(params.url);
}
return new Promise((reslove, reject) => {
let token = getStorageSync("token");
Taro.request({
url: domain + params.url,
method: params.method || "GET",
header: {
Authorization: "Bearer " + Taro.getStorageSync("token"),
Authorization: "Bearer " + token,
...params.header,
"content-type": params.data.contentType,
},
@ -208,7 +209,7 @@ export const AjaxFormData = (params) => {
content: "登录已过期,请重新登录",
showCancel: false,
}).then((res) => {
Taro.setStorageSync("token", null);
setStorageSync("token", null);
Taro.clearStorage(); // 清空所有缓存
Taro.reLaunch({
url: "/pages/initiate/initiate",
@ -240,7 +241,7 @@ export const AjaxFormData = (params) => {
}).then(() => {
reject(res);
if (res.data.code == 401 || res.data.msg === "登录状态已过期") {
Taro.setStorageSync("token", null);
setStorageSync("token", null);
Taro.reLaunch({
url: "/pages/initiate/initiate",
});

@ -1,4 +1,5 @@
import Taro from "@tarojs/taro";
import dayjs from "dayjs";
export const goOpenSetting = () => {
//去设置页的弹框
return new Promise((reslove, reject) => {
@ -286,27 +287,11 @@ export const setStorageSync = function (key, data, expires) {
// 如果没有传第三个有效期参数,就还是用原来的方法
if (!expires) return originSetStorageSync(key, data);
const reg = /\d{4}\/\d{1,12}\/\d{1,31}/; // 用来验证绝对时间格式`yyyy/MM/dd`或者`yyyy/MM/dd hh:mm:ss`
if (reg.test(expires)) {
// 绝对日期
const timestamp = new Date(expires + "").getTime();
if (isNaN(timestamp)) {
console.error(
expires +
" error 请传入正确的日期格式yyyy/MM/dd 或者 yyyy/MM/dd hh:mm:ss"
);
return originSetStorageSync(key, data);
}
originSetStorageSync(key, { data, expires: timestamp });
} else {
// 相对日期
if (typeof expires !== "number") {
console.error("expires is not a number");
return originSetStorageSync(key, data);
}
originSetStorageSync(key, { data, expires: +new Date() + expires });
}
originSetStorageSync(key, { data, expires: expires });
};
// 取
@ -314,10 +299,21 @@ const originGetStorageSymc = Taro.getStorageSync;
export const getStorageSync = function (key) {
const data = originGetStorageSymc(key);
// 如果data不是个对象就说明是没加有效期的直接返回
if (typeof data !== "object" || (typeof data === "object" && !data.expires))
if (typeof data !== "object" || (typeof data === "object" && !data.expires)) {
return data;
}
const now = new Date().getTime();
// console.log(key, data);
//
// console.log("now", now, dayjs(now).format("YYYY-MM-DD hh:mm:ss"));
// console.log(
// "expires",
// data.expires,
// dayjs(data.expires).format("YYYY-MM-DD hh:mm:ss")
// );
// console.log("now < data.expires", now < data.expires);
const now = +new Date();
if (now < data.expires) {
//用当前时间和存储的时间对比
return data.data; // 未过期返回data

16861
yarn.lock

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save