@@ -1,17 +1,21 @@
< template >
< view class = "home_warp" : class = "platformType ? '' :'iosplatformType'" >
< view class = "home_warp" : class = "platformType ? '' : 'iosplatformType'" >
<!-- 带背景的头部 -- >
< view class = "home_header_warp" > < / view >
< view class = "home_content_z_warp" >
< view class = "header_title_warp" >
<!-- < up-image src = "https://cex-pub.s3.ap-southeast-1.amazonaws.com/static/home/logo.png" width = "86" height = "30" bgColor = "#f1f6ff00" > < / up-image > -- >
<!-- < view class = "header_right_warp" > -- >
< view class = "language_warp" style = "width: 100%;justify-content: flex-start; " @click ="jumpSearch" >
< view style = "margin-top: 10rpx; " >
< up-image src = "https://cex-pub.s3.ap-southeast-1.amazonaws.com/static/home/search_b.png" width = "20" height = "20" bgColor = "#f1f6ff00" > < / up-image >
< view class = "language_warp" style = "width: 100%; justify-content: flex-start" @click ="jumpSearch" >
< view style = "margin-top: 10rpx" >
< up-image src = "https://cex-pub.s3.ap-southeast-1.amazonaws.com/static/home/search_b.png"
width = "20" height = "20" bgColor = "#f1f6ff00" > < / up-image >
< / view >
< text class = "search_msg_warp" > 搜索 < / text >
< / view >
< image src = "https://cex-pub.s3.ap-southeast-1.amazonaws.com/static/chart.png" class = "chart_img"
@click.stop ="jumpNewSearch('list')" > < / image >
< ! - - < view class = "language_warp" @click ="languageShow = true" >
< text > CN < / text >
< up-image src = "/static/common/down.png" width = "10" height = "10" bgColor = "#f1f6ff00" > < / up-image >
@@ -38,54 +42,58 @@
< / view > -- >
<!-- logo分类 -- >
< view class = "logo_banner" >
< view style = "padding: 20rpx 0 0 20rpx; " >
< up-image src = "https://cex-pub.s3.ap-southeast-1.amazonaws.com/static/home/logo_banner.png" width = "108" height = "16" bgColor = "#f1f6ff00" > < / up-image >
< view style = "padding: 20rpx 0 0 20rpx" >
< up-image src = "https://cex-pub.s3.ap-southeast-1.amazonaws.com/static/home/logo_banner.png"
width = "108" height = "16" bgColor = "#f1f6ff00" > < / up-image >
< view class = "logo_banner_title" > TB聚合商城 < / view >
< view class = "logo_banner_msg" > 全民共创共享的电商平台 < / view >
< / view >
< up-image src = "https://cex-pub.s3.ap-southeast-1.amazonaws.com/static/logo_banner2.png" width = "140" height = "98"
bgColor = "#f1f6ff00" > < / up-image >
< up-image src = "https://cex-pub.s3.ap-southeast-1.amazonaws.com/static/logo_banner2.png" width = "140"
height = "98" bgColor = "#f1f6ff00" > < / up-image >
< / view >
<!-- 分类 -- >
< view class = "home_sort_warp" >
< view class = "sort_comm_warp" v-if = "sortList && sortList.length !== 0 && isBlockedDate" >
< view v-for = "item in sortList" :key="item.id" class="sort_item_comm" @click="jumpSort(item)" >
< up -image :src = "item.icon" width = "40" height = "32" bgColor = "#f1f6ff00" > < / up-image >
< view class = "sort_item_title_comm" > { { item . name } } < / view >
< / view >
< / view >
< view v-else class = "not_order_warp" >
< up-image src = "https://cex-pub.s3.ap-southeast-1.amazonaws.com/static/not_order.png" width = "80" height = "80"
bgColor = "#f1f6ff00" > < / up-image >
< up-image src = "https://cex-pub.s3.ap-southeast-1.amazonaws.com/static/not_order.png" width = "80"
height = "80" bgColor = "#f1f6ff00" > < / up-image >
< view class = "not_order_msg_warp" > 暂无分类 < / view >
< / view >
< / view >
<!-- 带灰色背景的内容 -- >
< view class = "home_content_warp" >
<!-- 爆款专区 -- >
< view class = "product_comm hx_warp" @click ="onJumpYou" v-if = "faddishProduct && faddishProduct.length !== 0" >
< view class = "product_comm hx_warp" @click ="onJumpYou"
v-if = "faddishProduct && faddishProduct.length !== 0" >
< view class = "product_title" >
< view class = "product_title_left" >
< text class = "product_title_yp" > 信任桥优品 < / text >
< up-image src = "https://cex-pub.s3.ap-southeast-1.amazonaws.com/static/home/youxuan.png" width = "10" height = "10" bgColor = "#f1f6ff00" > < / up-image >
< text style = "margin-left: 6rpx;color: #FFFFFF;" > 品牌5折秒杀福利 < / text >
< up-image src = "https://cex-pub.s3.ap-southeast-1.amazonaws.com/static/home/youxuan.png"
width = "10" height = "10" bgColor = "#f1f6ff00" > < / up-image >
< text style = "margin-left: 6rpx; color: #ffffff" > 品牌5折秒杀福利 < / text >
< / view >
< view class = "product_title_f" style = "font-weight: bold; " >
< view class = "product_title_f" style = "font-weight: bold" >
< text style = "" > 立即抢购 < / text >
< view style = "margin: 6rpx 0 0 6rpx; " > < up-image src = "/static/common/right_y_st3.png" width = "12" height = "12"
bgColor = "#f1f6ff00" > < / up-image > < / view >
< view style = "margin: 6rpx 0 0 6rpx" > < up-image src = "/static/common/right_y_st3.png"
width = "12" height = "12" bgColor = "#f1f6ff00" > < / up-image > < / view >
< / view >
< / view >
< view
: class = "faddishProduct && faddishProduct.length > 2 ? 'product_content product_content2' : 'product_content'" >
< view : class = "faddishProduct && faddishProduct.length > 2
? 'product_content product_content2'
: 'product_content'
" >
< up-loading-icon :show = "productLoading" > < / up-loading-icon >
< view : class = "faddishProduct && faddishProduct.length > 2 ? 'product_item2' : 'product_item'"
v-for = "item in faddishProduct" :key="item.id" @click.stop="jumpInfo(item)" >
< view : class = "faddishProduct && faddishProduct.length > 2
? 'product_item2'
: 'product_item'
" v-for = "item in faddishProduct" :key="item.id" @click.stop="jumpInfo(item)" >
< up -image :src = "item.url" width = "100%" height = "130" bgColor = "#f1f6ff00" shape = "square"
radius = ' 15' > < / up-image >
radius = " 15" > < / up-image >
< view class = "product_f_item" >
< view class = "product_f_item_name" > { { item . title } } < / view >
< view class = "product_f_item_price product_f_item_price_hx" > 优选价 { { item . price } } 元 < / view >
@@ -104,12 +112,14 @@
< view > 好物随心兑 < / view >
< view class = "content_msg_but" >
立即抢购
< view style = "margin-top: 6rpx;margin-left: 4rpx; " > < up-image src = "/static/common/right_y.png"
width = "10 " height = "10" bgColor = "#f1f6ff00" > < / up-image > < / view >
< view style = "margin-top: 6rpx; margin-left: 4rpx" > < up-image
src = "/static/common/right_y.png " width = "10" height = "10"
bgColor = "#f1f6ff00" > < / up-image > < / view >
< / view >
< / view >
< / view >
< up-image src = "https://cex-pub.s3.ap-southeast-1.amazonaws.com/static/home/min_card_jfdh_2.png" width = "66" height = "66" bgColor = "#f1f6ff00" > < / up-image >
< up-image src = "https://cex-pub.s3.ap-southeast-1.amazonaws.com/static/home/min_card_jfdh_2.png"
width = "66" height = "66" bgColor = "#f1f6ff00" > < / up-image >
< / view >
<!-- 红包抽奖 -- >
< view class = "min_card_item" @click ="jumpTurntable" >
@@ -120,12 +130,14 @@
< view > 现金红包等你拿 ! < / view >
< view class = "content_msg_but" >
立即抢购
< view style = "margin-top: 6rpx;margin-left: 4rpx; " > < up-image src = "/static/common/right_y.png"
width = "10 " height = "10" bgColor = "#f1f6ff00" > < / up-image > < / view >
< view style = "margin-top: 6rpx; margin-left: 4rpx" > < up-image
src = "/static/common/right_y.png " width = "10" height = "10"
bgColor = "#f1f6ff00" > < / up-image > < / view >
< / view >
< / view >
< / view >
< up-image src = "https://cex-pub.s3.ap-southeast-1.amazonaws.com/static/home/min_card_hbcj_2.png" width = "66" height = "66" bgColor = "#f1f6ff00" > < / up-image >
< up-image src = "https://cex-pub.s3.ap-southeast-1.amazonaws.com/static/home/min_card_hbcj_2.png"
width = "66" height = "66" bgColor = "#f1f6ff00" > < / up-image >
< / view >
< / view >
<!-- 好物优选 -- >
@@ -135,20 +147,24 @@
< text class = "product_title_z" > 平价专区 < / text >
< text class = "product_title_zk" > 4 折起 < / text >
< / view >
< view class = "product_title_f" style = "color: #7632FF; " >
< view class = "product_title_f" style = "color: #7632ff " >
< text style = "" > 立即抢购 < / text >
< view style = "margin: 6rpx 0 0 6rpx; " > < up-image src = "/static/common/right_y_st4.png" width = "10" height = "10"
bgColor = "#f1f6ff00" > < / up-image > < / view >
< view style = "margin: 6rpx 0 0 6rpx" > < up-image src = "/static/common/right_y_st4.png"
width = "10" height = "10" bgColor = "#f1f6ff00" > < / up-image > < / view >
< / view >
< / view >
< view class = "product_tips" > 平价专区 抢到就是赚到 ! < / view >
< view
: class = "yxProduct && yxProduct.length > 3 ? 'product_content_yx product_content2' : 'product_content_yx'" >
< view : class = "yxProduct && yxProduct.length > 3
? 'product_content_yx product_content2'
: 'product_content_yx'
" >
< up-loading-icon :show = "productLoading" > < / up-loading-icon >
< view : class = "yxProduct && yxProduct.length < 4 ? 'product_item_yx product_item_yx2' : 'product_item_yx'"
v-for = "item in yxProduct" :key="item.id" >
< view : class = "yxProduct && yxProduct.length < 4
? 'product_item_yx product_item_yx2'
: 'product_item_yx'
" v-for = "item in yxProduct" :key="item.id" >
< up -image :src = "item.url" width = "100%" height = "80" bgColor = "#f1f6ff00" shape = "square"
radius = ' 10' > < / up-image >
radius = " 10" > < / up-image >
<!-- < view class = "product_f_item" >
< view class = "product_f_item_name" > { { item . title } } < / view >
< view class = "product_f_item_price product_f_item_price_yx" > 优选价 { { item . adPrice } } 元 < / view >
@@ -159,12 +175,11 @@
<!-- 为您精选 -- >
< choiceness / >
< / view >
< / view >
<!-- 暂未开放 -- >
< up-modal :show = "openShow" :showConfirmButton = "false" >
< view class = "slot-content" >
< view class = "close_warp" @click ="openShow = false; " >
< view class = "close_warp" @click ="openShow = false" >
< up -image src = "/static/common/close.png" width = "20" height = "20" bgColor = "#f1f6ff00" > < / up-image >
< / view >
< view class = "content_" >
@@ -172,7 +187,7 @@
< view class = "content_2" > 暂未开放 < / view >
< / view >
< view class = "but_" >
< view class = "but_copy" @click ="openShow = false; " > 确定 < / view >
< view class = "but_copy" @click ="openShow = false" > 确定 < / view >
< / view >
< / view >
< / up -modal >
@@ -184,12 +199,16 @@
< up-overlay :show = "bannerShow" >
< view class = "up_content" @tap.stop >
< view class = "uni-banner" >
< view class = "close_btn" @click ="bannerShow = false; " > < / view >
< view class = "close_btn" @click ="bannerShow = false" > < / view >
< view class = "banner_box" >
< view class = "conter" > { { updateApkObj . content } } < / view >
< view class = "banner_foot" v-if = "!bannerPercentageShow" >
< button @click ="goUpdate(updateApkObj, platformType)" class = "banner_foot_button" > 立即更新 < / button >
< view @click ="bannerShow = false;" class = "banner_foot_button_no" v-if = "!updateApkObj.isForce" > 暂不更新 < / view >
< button @click ="goUpdate(updateApkObj, platformType)" class = "banner_foot_button" >
立即更新
< / button >
< view @click ="bannerShow = false" class = "banner_foot_button_no"
v-if = "!updateApkObj.isForce" > 暂不更新
< / view >
< / view >
< view v-else >
< up -line -progress :percentage = "bannerPercentage" activeColor = "#a85cfa" > < / up-line-progress >
@@ -201,177 +220,240 @@
< / view >
< / view >
< / up-overlay >
<!-- 公告弹窗 -- >
< up-overlay :show = "newsShow" >
< view class = "up_content" @tap.stop >
< view class = "uni-banner-news" >
< view class = "close_btn" @click ="newsShow = false" > < / view >
< view class = "banner_box" >
< view class = "banner_box-title" > { { newsList [ 0 ] . title } } < / view >
< view class = "banner_box-subTitle" > { { newsList [ 0 ] . subTitle } } < / view >
< view class = "banner_box-btn" @click ="jumpNewSearch" > 查看 < / view >
< / view >
< / view >
< / view >
< / up -overlay >
< HomePopup :show = "homeShow" :dataObj = "curData" @jumpShop ="onJumpShop" > < / HomePopup >
< / view >
< / template >
< script >
import { getGoodsDetail } from "@/api/product.js" ;
import choiceness from ' @/components/choiceness/choiceness.vue' ;
import { searchList } from ' @/api/product.js' ;
import { getCascadeCategory , checkAppVersion , getCarouselImage } from '@/api/common.js' ;
import { SEARCH _TYPE , APP _PAGE _TYPE } from '@/utils/enumUtils.js'
import CustomTabBar from '@/components/custom-tab-bar.vue' ; // 引入自定义组件路径可能需要根据项目结构调整
import dayjs from 'dayjs' ;
import useTabber from "tabber-component" ;
import { comparisonVersionHandler } from '@/utils/index.js' ;
import HomePopup from '@/components/common/home-popup.vue'
import choiceness from " @/components/choiceness/choiceness.vue" ;
import { searchList } from " @/api/product.js" ;
import {
SHARE _URL ,
} from "@/utils/config.js" ;
getCascadeCategory ,
checkAppVersion ,
getCarouselImage ,
} from "@/api/common.js" ;
import { SEARCH _TYPE , APP _PAGE _TYPE } from "@/utils/enumUtils.js" ;
import CustomTabBar from "@/components/custom-tab-bar.vue" ; // 引入自定义组件路径可能需要根据项目结构调整
import dayjs from "dayjs" ;
import useTabber from "tabber-component" ;
import { getNewsList } from "@/api/news.js" ;
import { comparisonVersionHandler } from "@/utils/index.js" ;
import HomePopup from "@/components/common/home-popup.vue" ;
import { SHARE _URL } from "@/utils/config.js" ;
export default {
components : { choiceness , CustomTabBar , HomePopup } ,
components : { choiceness , CustomTabBar , HomePopup } ,
data ( ) {
return {
swiperList : [
] ,
swiperList : [ ] ,
currentNum : 0 ,
sortList : [ ] ,
languageShow : false , // 语言选项
languageShow : false , // 语言选项
languageList : [
{
name : '中文' ,
key : "CN"
} , {
name : '英文' ,
key : "EN"
name : "中文" ,
key : "CN" ,
} ,
{
name : "英文" ,
key : "EN" ,
} ,
] ,
currentLanguage : { } ,
yxProduct : [ ] , // 好物优选列表
faddishProduct : [ ] , // 爆款专区
hotList : [ ] , // 热门
yxProduct : [ ] , // 好物优选列表
faddishProduct : [ ] , // 爆款专区
hotList : [ ] , // 热门
productLoading : false ,
openShow : false ,
platformType : null , // 当前设备信息
platformType : null , // 当前设备信息
bannerShow : false , // 是否需要強制更新app
type : '' , // 设备类型 android:2, ios:1
type : "" , // 设备类型 android:2, ios:1
updateApkObj : { } , // 后台数据
bannerPercentageShow : false , // 是否显示进度条
bannerPercentage : 0 , // 进度条
curId : null ,
curData : null ,
homeShow : false
}
bannerPercentageShow : false , // 是否显示进度条
bannerPercentage : 0 , // 进度条
curId : null ,
curData : null ,
homeShow : false ,
newsList : [ ] , // 公告列表
newsShow : false , // 是否显示公告弹窗
} ;
} ,
onShow ( ) {
/*#ifdef APP-PLUS*/
uni . hideTabBar ( {
animation : false
} )
animation : false ,
} ) ;
/*#endif*/
// 获取设备是安卓还是ios
const appUpdate = uni . getStorageSync ( ' platform' ) ;
const appUpdate = uni . getStorageSync ( " platform" ) ;
const versionUpdateTime = uni . getStorageSync ( "versionUpdateTime" ) ;
// #ifdef APP-PLUS
console . log ( "上次更新时间 versionUpdateTime" , dayjs ( versionUpdateTime ) . format ( "YYYY-MM-DD HH:mm:ss" ) ) ;
console . log (
"上次更新时间 versionUpdateTime" ,
dayjs ( versionUpdateTime ) . format ( "YYYY-MM-DD HH:mm:ss" )
) ;
console . log ( "当前时间戳" , dayjs ( ) . format ( "YYYY-MM-DD HH:mm:ss" ) ) ;
const time1 = dayjs ( versionUpdateTime ) ; // 上一次更新的时间
const time1 = dayjs ( versionUpdateTime ) ; // 上一次更新的时间
const time2 = dayjs ( ) ;
const diff = time2 . diff ( time1 ) ;
if ( ! versionUpdateTime || diff > 5 * 60 * 1000 ) {
this . platformType = appUpdate == 'android' ? 'ANDROID' : 'IOS' ;
this . checkUpdate ( ) ; // 判断是否需要更新
this . platformType = appUpdate == "android" ? "ANDROID" : "IOS" ;
this . checkUpdate ( ) ; // 判断是否需要更新
} else {
this . onClipboard ( ) ;
}
// #endif
this . getSortList ( ) ;
this . querySearchList ( SEARCH _TYPE . SOMETHING ) ; // 好物专区
this . querySearchList ( SEARCH _TYPE . EXPLOSIVE ) ; // 爆单专区
this . querySearchList ( SEARCH _TYPE . SOMETHING ) ; // 好物专区
this . querySearchList ( SEARCH _TYPE . EXPLOSIVE ) ; // 爆单专区
this . getCarouselImage ( ) ;
this . onNews ( ) ; // 获取公告
} ,
onLoad ( ) {
} ,
mounted ( ) {
} ,
onLoad ( ) { } ,
mounted ( ) { } ,
methods : {
onJumpShop ( ) {
// 获取公告
jumpNewSearch ( type ) {
if ( type === 'list' ) {
uni . navigateTo ( { url : "/pages/login_package/announcement/announcement" } ) ;
return ;
}
uni . setStorageSync ( "isReadNews" , this . newsList [ 0 ] . id ) ;
uni . navigateTo ( {
url : ` /pages/other_package/productInfo/productInfo?id= ${ this . curId } `
} )
url :
"/pages/login_package/announcement-detail/announcement-detail?id=" +
this . newsList [ 0 ] . id ,
} ) ;
} ,
onNews ( ) {
getNewsList ( {
category : 2 ,
type : 0 ,
page : 1 ,
pageSize : 10 ,
} ) . then ( ( res ) => {
console . log ( "获取公告" , res ) ;
if ( res . bizcode === 100 ) {
this . newsList = res . data . entitys || [ ] ;
console . log ( this . newsList ) ;
const id = uni . getStorageSync ( "isReadNews" ) ;
this . newsShow = false ;
if ( id != this . newsList [ 0 ] . id && this . newsList [ 0 ] . isPop === 1 ) {
this . newsShow = true ;
}
}
} ) ;
} ,
// 查看详情
onJumpNews ( ) {
uni . navigateTo ( {
url : ` /pages/login_package/news/news?id= ${ this . newsList [ 0 ] . id } ` ,
} ) ;
} ,
onJumpShop ( ) {
uni . navigateTo ( {
url : ` /pages/other_package/productInfo/productInfo?id= ${ this . curId } ` ,
} ) ;
this . curId = null ;
this . curData = null ;
this . homeShow = false ;
} ,
onClipboard ( ) {
onClipboard ( ) {
let _this = this ;
uni . getClipboardData ( {
success : function ( res ) {
success : function ( res ) {
// http://localhost:5173/#/pages/other_package/productInfo/productInfo?id=1038
console . log ( res . data ) ; // 剪贴板内容
if ( res . data . indexOf ( ` ${ SHARE _URL } /#/pages/other_package/productInfo/productInfo?id= ` ) != - 1 ) {
console . log ( res . data ) ; // 剪贴板内容
if (
res . data . indexOf (
` ${ SHARE _URL } /#/pages/other_package/productInfo/productInfo?id= `
) != - 1
) {
uni . showModal ( {
title : '' ,
content : ' 当前APP想要粘贴商品详情,是否继续?' ,
success : ( res1 => {
if ( res1 . confirm ) {
title : "" ,
content : " 当前APP想要粘贴商品详情,是否继续?" ,
success : ( res1 ) => {
if ( res1 . confirm ) {
let id = res . data . match ( /=(.*?)\s/ ) ;
_this . curId = Number ( id [ 1 ] ) ;
_this . getShop ( ) ;
uni . setClipboardData ( {
data : '' ,
data : "" ,
} ) ;
}
} ) ,
fail : ( res2 => {
} ,
fail : ( res2 ) => {
uni . setClipboardData ( {
data : '' ,
data : "" ,
} ) ;
} )
} )
} ,
} ) ;
}
} ,
fail : function ( err ) {
console . error ( ' 获取剪贴板内容失败' , err ) ;
}
} ,
fail : function ( err ) {
console . error ( " 获取剪贴板内容失败" , err ) ;
} ,
} ) ;
} ,
getShop ( ) {
getShop ( ) {
const params = {
id : this . curId ,
id : this . curId ,
} ;
getGoodsDetail ( params ) . then ( res => {
getGoodsDetail ( params ) . then ( ( res ) => {
this . curData = res . data ;
this . homeShow = true ;
} ) ;
} ,
onJumpYou ( ) {
onJumpYou ( ) {
uni . navigateTo ( {
url : ' /pages/rwa_package/shop/you-shop'
} )
url : " /pages/rwa_package/shop/you-shop" ,
} ) ;
} ,
checkUpdate ( ) {
const self = this ,
localAppVersonName = uni . getStorageSync ( ' version' ) ,
localAppVerson = uni . getStorageSync ( ' versionCode' ) ;
localAppVersonName = uni . getStorageSync ( " version" ) ,
localAppVerson = uni . getStorageSync ( " versionCode" ) ;
// #ifdef APP-PLUS
plus . runtime . getProperty ( plus . runtime . appid , function ( widgetInfo ) {
const params = {
terminal : self . platformType ,
versionCode : localAppVerson ,
}
console . log ( "wgt更新-0" , params )
checkAppVersion ( params ) . then ( res => {
console . log ( "wgt更新-1" , res )
} ;
console . log ( "wgt更新-0" , params ) ;
checkAppVersion ( params ) . then ( ( res ) => {
console . log ( "wgt更新-1" , res ) ;
if ( res && res . bizcode === 100 ) {
const data = res . data || { } ;
// app大版本更新,versionName: 1.0.1 versionCode: 102
if ( data && Object . keys ( data ) . length !== 0 && comparisonVersionHandler ( localAppVerson , data . versionCode ) ) {
uni . hideTabBar ( ) // 隐藏首页底部tabbar 按钮
if (
data &&
Object . keys ( data ) . length !== 0 &&
comparisonVersionHandler ( localAppVerson , data . versionCode )
) {
uni . hideTabBar ( ) ; // 隐藏首页底部tabbar 按钮
self . updateApkObj = data ;
self . bannerShow = true ; // 显示弹窗
self . bannerShow = true ; // 显示弹窗
return ;
} else {
console . log ( "wgt更新-2" )
console . log ( "wgt更新-2" ) ;
self . onClipboard ( ) ;
return ;
}
@@ -384,37 +466,46 @@ export default {
// 安装
goUpdate ( updateApkObj , platformType ) {
const self = this ;
if ( platformType == ' ANDROID' ) {
if ( platformType == " ANDROID" ) {
// 弹出系统等待对话框
var dtask = plus . downloader . createDownload ( updateApkObj . downloadUrl , { } , function ( d , status ) {
// 下载完成
if ( status == 200 ) {
plus . runtime . install ( plus . io . convertLocalFileSystemURL ( d . filename ) , { force : true } , function ( resp ) {
// 直接重启APP
uni . setStorageSync ( 'versionUpdateTime' , dayjs ( ) . valueOf ( ) ) ; // 记录升级的时间
plus . runtime . restart ( ) ;
} , function ( error ) {
console . log ( "error" , error ) ;
var dtask = plus . downloader . createDownload (
updateApkObj . downloadUrl ,
{ } ,
function ( d , status ) {
// 下载完成
if ( status == 200 ) {
plus . runtime . install (
plus . io . convertLocalFileSystemURL ( d . filename ) ,
{ force : true } ,
function ( resp ) {
// 直接重启APP
uni . setStorageSync ( "versionUpdateTime" , dayjs ( ) . valueOf ( ) ) ; // 记录升级的时间
plus . runtime . restart ( ) ;
} ,
function ( error ) {
console . log ( "error" , error ) ;
uni . showToast ( {
title : error . message ,
mask : false ,
duration : 1500 ,
} ) ;
}
) ;
} else {
self . bannerPercentageShow = false ;
uni . showToast ( {
title : error . message ,
title : "更新失败" ,
mask : false ,
duration : 1500
duration : 1500 ,
} ) ;
} ) ;
} else {
self . bannerPercentageShow = false ;
uni . showToast ( {
title : '更新失败' ,
mask : false ,
duration : 1500
} ) ;
}
}
} ) ;
) ;
try {
dtask . start ( ) ; // 开启下载的任务
let prg = 0 ;
this . bannerPercentageShow = true ;
dtask . addEventListener ( ' statechanged' , function ( task , status ) {
dtask . addEventListener ( " statechanged" , function ( task , status ) {
// 给下载任务设置一个监听 并根据状态 做操作
switch ( task . state ) {
case 1 :
@@ -422,12 +513,16 @@ export default {
case 2 :
break ;
case 3 :
prg = parseInt ( ( parseFloat ( task . downloadedSize ) / parseFloat ( task . totalSize ) ) * 100 ) ;
prg = parseInt (
( parseFloat ( task . downloadedSize ) /
parseFloat ( task . totalSize ) ) *
100
) ;
self . bannerPercentage = prg ;
break ;
case 4 :
plus . nativeUI . closeWaiting ( ) ;
self . bannerShow = false ; // 显示弹窗
self . bannerShow = false ; // 显示弹窗
break ;
}
} ) ;
@@ -435,12 +530,13 @@ export default {
console . log ( "更新失败-03err" , err ) ;
plus . nativeUI . closeWaiting ( ) ;
uni . showToast ( {
title : ' 更新失败-03' ,
title : " 更新失败-03" ,
mask : false ,
duration : 1500
duration : 1500 ,
} ) ;
}
} else if ( platformType == ' IOS' ) { // ios跳转到app store
} else if ( platformType == " IOS" ) {
// ios跳转到app store
plus . runtime . openURL ( updateApkObj . downloadUrl ) ;
}
} ,
@@ -449,40 +545,41 @@ export default {
async getCarouselImage ( ) {
const params = {
pageUi : APP _PAGE _TYPE . HOME ,
}
} ;
const resp = await getCarouselImage ( params ) ;
if ( resp && resp . bizcode === 100 ) {
const data = resp . data || [ ] ;
this . swiperList = data . length !== 0 ? data . map ( obj => obj . carouselImage ) : [ ] ;
this . swiperList =
data . length !== 0 ? data . map ( ( obj ) => obj . carouselImage ) : [ ] ;
}
} ,
jumpIntegral ( ) {
uni . navigateTo ( {
url : ' /pages/rwa_package/shop/fen-shop' ,
} )
url : " /pages/rwa_package/shop/fen-shop" ,
} ) ;
} ,
jumpTurntable ( ) {
// uni.navigateTo({
// url: '/pages/other_package/turntable/turntable?backPath=home',
// })
uni . navigateTo ( {
url : ' /pages/other_package/nine-grid/nine-grid?backPath=home' ,
} )
url : " /pages/other_package/nine-grid/nine-grid?backPath=home" ,
} ) ;
} ,
jumpPrdference ( ) {
uni . switchTab ( {
url : ' /pages/supply_chain/supply_chain' ,
} )
url : " /pages/supply_chain/supply_chain" ,
} ) ;
} ,
jumpWelcome ( ) {
uni . navigateTo ( {
url : ' /pages/login_package/welcome/welcome' ,
} )
url : " /pages/login_package/welcome/welcome" ,
} ) ;
} ,
jumpSearch ( ) {
uni . navigateTo ( {
url : ' /pages/rwa_package/dongjian/search' ,
} )
url : " /pages/rwa_package/dongjian/search" ,
} ) ;
} ,
/**
* 查询商品列表
@@ -492,14 +589,16 @@ export default {
const params = {
type ,
page : 1 ,
isRecomm : true ,
isRecomm : true ,
pageSize : type === SEARCH _TYPE . SOMETHING ? 4 : 3 ,
}
} ;
const resp = await searchList ( params ) ;
if ( resp && resp . bizcode === 100 ) {
if ( type === SEARCH _TYPE . SOMETHING ) { // 好物优选
if ( type === SEARCH _TYPE . SOMETHING ) {
// 好物优选
this . yxProduct = resp . data ;
} else if ( type === SEARCH _TYPE . EXPLOSIVE ) { // 爆单专区
} else if ( type === SEARCH _TYPE . EXPLOSIVE ) {
// 爆单专区
this . faddishProduct = resp . data ;
}
}
@@ -516,25 +615,25 @@ export default {
} ,
// 跳转到分类栏目
jumpSort ( item ) {
uni . setStorageSync ( ' sortId' , item . id ) ;
uni . switchTab ( { // 首页
url : '/pages/sort/sort' ,
} )
uni . setStorageSync ( " sortId" , item . id ) ;
uni . switchTab ( {
// 首页
url : "/pages/sort/sort" ,
} ) ;
} ,
// 跳转到商品详情
jumpInfo ( item ) {
uni . navigateTo ( {
url : ' /pages/other_package/productInfo/productInfo?id=' + item . id ,
} )
}
url : " /pages/other_package/productInfo/productInfo?id=" + item . id ,
} ) ;
} ,
} ,
computed : {
isBlockedDate ( ) {
return ! useTabber ( 13 ) ;
}
}
}
} ,
} ,
} ;
< / script >
< style lang = "scss" scoped >
@@ -543,15 +642,16 @@ export default {
height : calc ( 100 vh - env ( safe - area - inset - bottom ) ) ; // 是底部的导航栏高度
overflow : auto ;
position : relative ;
& . iosplatformType {
height : 100 vh ;
& . iosplatformType {
height : 100 vh ;
}
}
. home _header _warp {
// background-color: #AC2A29FF;
// background: linear-gradient(0deg, $app-bj, #AC2A29FF);
background : linear - gradient ( 270 deg , # AF39C4 0 % , # 7732 FF 100 % ) ;
background : linear - gradient ( 270 deg , # af39c4 0 % , # 7732 ff 100 % ) ;
height : 500 rpx ;
padding : 100 rpx 30 rpx 0 rpx ;
}
@@ -562,6 +662,7 @@ export default {
. header _title _warp {
display : flex ;
align - items : center ;
margin - bottom : 30 rpx ;
padding : 0 30 rpx ;
}
@@ -581,7 +682,12 @@ export default {
background : # ffffff30 ;
border - radius : 24 rpx ;
background : linear - gradient ( 270 deg , # ae39c5 , # 7932 fe ) 2 2 ;
}
. chart _img {
width : 50 rpx ;
height : 50 rpx ;
margin - left : 15 rpx ;
}
. search _msg _warp {
@@ -596,7 +702,7 @@ export default {
display : flex ;
justify - content : space - between ;
padding : 0 30 rpx ;
color : # FFFFFF ;
color : # ffffff ;
. logo _banner _title {
font - weight : bold ;
@@ -644,16 +750,16 @@ export default {
. product _comm {
border - radius : 30 rpx ;
padding : 10 rpx ;
color : # FFFFFF ;
color : # ffffff ;
margin - top : 20 rpx ;
}
. yx _warp {
background : linear - gradient ( 270 deg , # FDEFFF 0 % , # EDE3FF 100 % ) ;
background : linear - gradient ( 270 deg , # fdefff 0 % , # ede3ff 100 % ) ;
}
. hx _warp {
background : linear - gradient ( 270 deg , # B164FB 0 % , $app - zt - color 100 % ) ;
background : linear - gradient ( 270 deg , # b164fb 0 % , $app - zt - color 100 % ) ;
}
. product _title {
@@ -666,14 +772,14 @@ export default {
. product _title _yp {
font - weight : 800 ;
font - size : 36 rpx ;
color : # FFFFFF ;
color : # ffffff ;
margin - right : 10 rpx ;
}
. product _title _z {
font - weight : 800 ;
font - size : 36 rpx ;
color : # 333333 FF ;
color : # 333333 ff ;
margin - right : 10 rpx ;
}
@@ -692,7 +798,7 @@ export default {
. product _title _f {
font - size : 20 rpx ;
color : # FFFFFF ;
color : # ffffff ;
margin - left : 10 rpx ;
display : flex ;
align - items : center ;
@@ -704,7 +810,7 @@ export default {
}
. product _content {
background - color : # FFFFFF ;
background - color : # ffffff ;
padding : 20 rpx ;
border - radius : 24 rpx ;
display : flex ;
@@ -740,9 +846,9 @@ export default {
bottom : 0 ;
width : calc ( 100 % - 40 rpx ) ;
height : 66 rpx ;
background : # F0E7FE ;
background : # f0e7fe ;
border - radius : 0 rpx 0 rpx 12 rpx 12 rpx ;
border : 1 rpx solid # FFFFFF ;
border : 1 rpx solid # ffffff ;
padding : 10 rpx 20 rpx ;
font - size : 18 rpx ;
color : # 000000 ;
@@ -762,24 +868,24 @@ export default {
. product _f _item _price {
text - align : center ;
border - radius : 10 rpx ;
color : # FFFFFF ;
color : # ffffff ;
margin - top : 10 rpx ;
padding : 2 rpx 0 ;
}
. product _f _item _price _yx {
background : # FFBA41 ;
background : # ffba41 ;
}
. product _f _item _price _hx {
background : linear - gradient ( 270 deg , # AF39C4 0 % , # 7732 FF 100 % ) ;
background : linear - gradient ( 270 deg , # af39c4 0 % , # 7732 ff 100 % ) ;
}
. product _tips {
font - size : 24 rpx ;
line - height : 40 rpx ;
margin - left : 20 rpx ;
background : linear - gradient ( 180 deg , # B039C2 0 % , # 8 B34E9 23 % , # 7632 FF 100 % ) ;
background : linear - gradient ( 180 deg , # b039c2 0 % , # 8 b34e9 23 % , # 7632 ff 100 % ) ;
- webkit - background - clip : text ;
color : transparent ;
display : inline - block ;
@@ -797,7 +903,7 @@ export default {
border - radius : 30 rpx ;
opacity : 0.8 ;
border - radius : 16 rpx ;
border : 1 rpx solid # DFDFDF ;
border : 1 rpx solid # dfdfdf ;
display : flex ;
justify - content : space - between ;
}
@@ -823,14 +929,12 @@ export default {
align - items : center ;
margin - top : 20 rpx ;
}
}
}
// 热门榜
. hot _warp {
background : # FFFFFF ;
background : # ffffff ;
border - radius : 30 rpx ;
padding : 20 rpx ;
margin - top : 20 rpx ;
@@ -858,7 +962,7 @@ export default {
}
. good _ _msg _warp {
background : # FFF8F3 ;
background : # fff8f3 ;
/* border-radius: 18rpx; */
border - top : 2 rpx solid $app - zt - color ;
border - right : 2 rpx solid $app - zt - color ;
@@ -939,4 +1043,67 @@ export default {
}
}
}
. uni - banner - news {
width : 540 rpx ;
margin : 0 auto ;
background : url ( https : //cex-pub.s3.ap-southeast-1.amazonaws.com/static/new-home.png) no-repeat;
background - size : 100 % 100 % ;
. close _btn {
position : absolute ;
top : 0 ;
right : 0 ;
width : 48 rpx ;
height : 48 rpx ;
}
. banner _box - news {
height : 700 rpx ;
// padding:40rpx;
width : 90 % ;
}
. banner _box - title {
font - weight : 500 ;
font - size : 16 px ;
color : # 333333 ;
overflow : hidden ;
display : - webkit - box ;
- webkit - box - orient : vertical ;
- webkit - line - clamp : 2 ;
/* 下面两行是为了兼容老版本 Firefox */
line - clamp : 2 ;
box - orient : vertical ;
margin - top : 250 rpx ;
}
. banner _box - subTitle {
font - size : 14 px ;
color : # 868686 ;
overflow : hidden ;
display : - webkit - box ;
- webkit - box - orient : vertical ;
- webkit - line - clamp : 3 ;
/* 下面两行是为了兼容老版本 Firefox */
line - clamp : 3 ;
box - orient : vertical ;
margin - top : 30 rpx ;
}
. banner _box - btn {
width : 240 px ;
height : 40 px ;
background : linear - gradient ( 270 deg , # af39c4 0 % , # 7732 ff 100 % ) ;
border - radius : 8 px ;
font - weight : 500 ;
font - size : 16 px ;
color : # ffffff ;
display : flex ;
justify - content : center ;
align - items : center ;
position : fixed ;
bottom : 60 rpx ;
}
}
< / style >