🐞 fix:优化分享图片,修复我的页面无法触发用户信息授权弹窗

This commit is contained in:
czm 2022-08-01 11:32:49 +08:00
parent 6ea58ad911
commit ac4cd5ddb8
6 changed files with 194 additions and 205 deletions

View File

@ -44,12 +44,7 @@ export const throttle = (fn, delay) => {
export const getFilterData = (val = {}, arr: string[] = []) => {
let res = {}
for (let key in val) {
if (
val[key] !== undefined &&
val[key] !== null &&
val[key] !== '' &&
!arr.includes(key)
) {
if (val[key] !== undefined && val[key] !== null && val[key] !== '' && !arr.includes(key)) {
if (typeof val[key] == 'number') {
if (!isNaN(val[key])) {
res[key] = val[key]
@ -100,15 +95,7 @@ export const screenshot = (url, suffix = '!w200') => {
}
//获取数据加载状态 //0:数据从无到有加载数据1没有任何数据 2下拉加载3下拉没有数据
export const dataLoadingStatus = ({
list = [],
total = 0,
status = false,
}: {
list: any[]
total: number
status: true | false
}) => {
export const dataLoadingStatus = ({ list = [], total = 0, status = false }: { list: any[]; total: number; status: true | false }) => {
if (list.length == 0 && status) {
return 0
} else if (list.length == 0 && !status) {
@ -132,25 +119,20 @@ export const shareShop = () => {
let path = ''
let title = ''
let imageUrl = ''
let sortCode = Taro.getStorageSync('sort_code')
? JSON.parse(Taro.getStorageSync('sort_code'))
: ''
let sortCode = Taro.getStorageSync('sort_code') ? JSON.parse(Taro.getStorageSync('sort_code')) : ''
let pageInfo: any = page
//商品详情分享
if (pageInfo.route === 'pages/details/index') {
path = `/pages/details/index?share=${sortCode.shareShortDetail.code}`
title = sortCode.shareShortDetail.title
imageUrl = sortCode.shareShortDetail.img
imageUrl = formatImgUrl(sortCode.shareShortDetail.img, '!w600')
} else {
path =
pageInfo.route === 'pages/user/index'
? `/pages/user/index?share=${sortCode.shareShortPage.code}`
: `/pages/index/index?share=${sortCode.shareShortPage.code}`
title = sortCode.shareShortPage.title
imageUrl =
pageInfo.route === 'pages/user/index'
? sortCode.shareShortPage.img
: formatImgUrl('/mall/share_img_02.png')
imageUrl = pageInfo.route === 'pages/user/index' ? formatImgUrl(sortCode.shareShortPage.img, '!w600') : formatImgUrl('/mall/share_img_02.png', '!w600')
}
return {
title,

View File

@ -1,15 +1,15 @@
import Taro, { FC } from "@tarojs/taro"
import { memo, useEffect, useState } from "react"
import useUploadCDNImg from "@/use/useUploadImage";
import { Image, Text, View } from "@tarojs/components";
import { formatImgUrl } from "@/common/fotmat";
import classnames from "classnames";
import Taro, { FC } from '@tarojs/taro'
import { memo, useEffect, useState } from 'react'
import useUploadCDNImg from '@/use/useUploadImage'
import { Image, Text, View } from '@tarojs/components'
import { formatImgUrl } from '@/common/fotmat'
import classnames from 'classnames'
import styles from './index.module.scss'
//图片列表
type ImageParam = {
onChange?:(val: string[]) => void,
defaultList?: string[],
onChange?: (val: string[]) => void
defaultList?: string[]
onlyRead?: false | true
}
const PictureItem: FC<ImageParam> = memo(({ onChange, defaultList, onlyRead = false }) => {
@ -24,7 +24,7 @@ const PictureItem:FC<ImageParam> = memo(({onChange, defaultList, onlyRead = fals
const uploadImage = async () => {
let list: any = await getWxPhoto('after-sale', 5)
let images: any[] = []
list?.map(item => {
list?.map((item) => {
images.push(item.url)
})
setImageLise([...imageList, ...images])
@ -41,26 +41,29 @@ const PictureItem:FC<ImageParam> = memo(({onChange, defaultList, onlyRead = fals
//预览图片
const showImage = () => {
let list = imageList?.map(item => {
let list = imageList?.map((item) => {
return formatImgUrl(item, '!w800')
})
Taro.previewImage({
current: list[0], // 当前显示
urls: list // 需要预览的图片http链接列表
urls: list, // 需要预览的图片http链接列表
})
}
return (
<View className={styles.image_main}>
{imageList?.map((item, index) =>
{imageList?.map((item, index) => (
<View className={styles.ImgItem}>
<Image mode="aspectFill" src={formatImgUrl(item)} onClick={showImage}></Image>
<Image mode='aspectFill' src={formatImgUrl(item)} onClick={showImage}></Image>
{!onlyRead && <View onClick={() => delImage(index)} className={classnames(styles.miconfont_close, 'iconfont icon-qingkong')}></View>}
</View>)}
{!onlyRead && <View className={styles.uploadImg } onClick={uploadImage}>
<Text className={classnames(styles.miconfont, 'iconfont icon-saomazhifu')}></Text>
</View>
))}
{!onlyRead && (
<View className={styles.uploadImg} onClick={uploadImage}>
<Text className={classnames(styles.miconfont, 'iconfont icon-shangchuanzhaopian')}></Text>
<Text className={styles.uploadText}></Text>
</View>}
</View>
)}
</View>
)
})

View File

@ -6,7 +6,7 @@ import OrderCount from './components/orderCount'
import ShopCart from '@/components/shopCart'
import styles from './index.module.scss'
import { useCallback, useEffect, useMemo, useState } from 'react'
import { formatHashTag } from '@/common/fotmat'
import { formatHashTag, formatImgUrl } from '@/common/fotmat'
import { GetProductDetailApi } from '@/api/material'
import useLogin from '@/use/useLogin'
import { AnalysisShortCodeApi, GetShortCodeApi } from '@/api/share'
@ -102,7 +102,7 @@ export default (props: Params) => {
type: ShareDetail.value,
product_id: parseInt(params.id),
})
const img = IMG_CND_Prefix + (productInfo.texture_url ? productInfo.texture_url.split(',')[0] : '/mall/share_img_01.png')
const img = formatImgUrl(productInfo.texture_url || '/mall/share_img_01.png', '!w400')
setSortCode({ ...userObj.sort_code, shareShortDetail: { title: productName as string, code: resDetail.md5_key, img: img } })
}

View File

@ -4,7 +4,7 @@
.address_title_tag {
font-size: 24px;
color: #EE7500;
color: #ee7500;
background: rgba(255, 230, 206, 0.36);
border-radius: 20px 20px 0px 0px;
height: 56px;
@ -19,7 +19,7 @@
}
.order_address {
height: 178px;
min-height: 178px;
background: #ffffff;
border-radius: 0 0 20px 20px;
display: flex;
@ -78,13 +78,11 @@
width: 152px;
font-size: 28px;
height: 60px;
color:#007AFF;
color: #007aff;
z-index: 999;
border: 2px solid #007AFF;
border: 2px solid #007aff;
border-radius: 36px;
text-align: center;
line-height: 60px;
}
}

View File

@ -1,5 +1,5 @@
.main {
background-color: #F8F8F8;
background-color: #f8f8f8;
min-height: 100vh;
display: flex;
flex-direction: column;
@ -17,8 +17,12 @@
}
.auth-suspension {
position: absolute;
position: fixed;
left: 0;
top: 0;
z-index: 1;
width: 100vw;
height: 100vh;
inset: 0;
}
@ -58,7 +62,7 @@
.arcd-info-left-portrait {
width: 170px;
height: 170px;
background: rgba(0, 0, 0, 0.00);
background: rgba(0, 0, 0, 0);
border: 4px solid #ffffff;
border-radius: 50%;
overflow: hidden;
@ -153,7 +157,6 @@
width: auto;
}
}
}
.card-main-title text {
@ -181,7 +184,7 @@
.card-main-title-content-item Text {
font-size: 56px;
color: #3C3C3C;
color: #3c3c3c;
}
.card-main-title-content-item-badge {
@ -315,14 +318,14 @@
.auth-status,
.auth-status-ongoing {
color: #EE7500;
background-color: #FFE6CE;
color: #ee7500;
background-color: #ffe6ce;
}
.auth-status,
.auth-status-adopt {
color: #007AFF;
background-color: #CDE5FF;
color: #007aff;
background-color: #cde5ff;
}
.auth-tips {
@ -334,7 +337,7 @@
.auth-tips,
.auth-tips-adopt {
color: #ABABAB;
color: #ababab;
}
.auth-tips text {
@ -426,7 +429,7 @@
.tips-modal-button {
display: flex;
border-top: 1px solid #DDDDDD;
border-top: 1px solid #dddddd;
margin-top: 45px;
}
@ -445,7 +448,7 @@
font-weight: 400;
color: #707070;
border-radius: 0;
border-right: 1px solid #DDDDDD;
border-right: 1px solid #dddddd;
}
.tips-modal-button button::after {
@ -537,7 +540,7 @@
padding-left: 10px;
width: 100px;
height: 32px;
background: rgba(255, 0, 0, 0.10);
background: rgba(255, 0, 0, 0.1);
border-radius: 10px;
color: #ff0000;
}

View File

@ -23,6 +23,7 @@ export default () => {
const handleAuth = async () => {
console.log('授权面版')
if (adminUserInfo?.is_authorize_name) return false
getSelfUserInfo()
.then()
.catch(() => {
@ -37,26 +38,28 @@ export default () => {
getAdminUserInfo()
Apiassets()
})
const checkGo = () => {
if (
adminUserInfo?.authentication_status === 0 ||
adminUserInfo?.authentication_status === 1 ||
adminUserInfo?.authentication_status === 2 ||
adminUserInfo?.authentication_status === 3
) {
Taro.showModal({
const checkGo = async () => {
if (adminUserInfo?.authentication_status !== 4) {
let res = await Taro.showModal({
title: '提示',
content: '你还未认证,认证后解锁更多功能',
content: '你暂未开通授信,目前仅支持线下申请,开通后可使用账期采购。',
cancelText: '稍后认证',
confirmText: '去认证',
confirmText: '联系客服',
})
if (res.confirm) {
Taro.showModal({
content: '联系电话:0757-8270 6695',
cancelText: '取消',
confirmText: '拨打',
success: function (res) {
if (res.confirm) {
Taro.navigateTo({ url: '/pages/certification/index' })
} else if (res.cancel) {
console.log('用户点击取消')
Taro.makePhoneCall({
phoneNumber: '(0757)82706695',
})
}
},
})
}
} else {
Taro.navigateTo({
url: '/pages/creditLine/index',
@ -72,7 +75,7 @@ export default () => {
{/* 测试暂时添加 */}
<View style={{ fontSize: '26rpx', color: '#707070', textAlign: 'center' }}>{current_version}</View>
{current_env === 'development' && <View style={{ fontSize: '26rpx', color: '#707070', textAlign: 'center' }}>{BASE_URL}</View>}
{!adminUserInfo?.is_authorize_name && <View onClick={handleAuth} className={styles['auth-suspension']}></View>}
{!adminUserInfo?.is_authorize_name && <View onClick={handleAuth} catchMove className={styles['auth-suspension']}></View>}
</View>
)
}
@ -133,7 +136,7 @@ const Header = memo((props: any) => {
})
}
return (
<View className={styles.header}>
<View className={styles.header} onClick={props.onClick}>
<View className={`${styles.crad} ${styles['header-card']}`}>
<View className={styles['card-info']}>
<View className={styles['arcd-info-left']}>