feat: 启动页

This commit is contained in:
2025-12-17 16:22:19 +08:00
parent 97f2bfe14b
commit 761f273a5d
8 changed files with 1647 additions and 1413 deletions
+5
View File
@@ -10,6 +10,11 @@
{
"playground" : "standard",
"type" : "uni-app:app-ios"
},
{
"customPlaygroundType" : "device",
"playground" : "standard",
"type" : "uni-app:app-ios_simulator"
}
]
}
+143 -94
View File
@@ -1,42 +1,49 @@
<script>
export default {
onLaunch: function() {
console.log('App Launch')
export default {
globalData: {
launchShown: false, // 内存标记,杀进程就清空
},
onLaunch: function () {
console.log("App Launch");
const res = uni.getSystemInfoSync();
uni.setStorageSync('platform', res.platform);
// #ifdef APP-PLUS         
uni.setStorageSync("platform", res.platform);
// #ifdef APP-PLUS
plus.navigator.closeSplashscreen(); // 立即关闭原生闪屏
// 获取应用版本信息
plus.runtime.getProperty(plus.runtime.appid, function(inf) {
console.log("版本信息",inf.versionCode)
uni.setStorageSync('version-1', inf.version); // 大版本号
uni.setStorageSync('versionCode', inf.versionCode); // 小版本号
plus.runtime.getProperty(plus.runtime.appid, function (inf) {
console.log("版本信息", inf.versionCode);
uni.setStorageSync("version-1", inf.version); // 大版本号
uni.setStorageSync("versionCode", inf.versionCode); // 小版本号
});
let uuid = plus.device.uuid;
// #endif
},
onShow: function() {
console.log('App Show')
onShow: function () {
console.log("App Show");
// 隐藏原生tabbar
/*#ifdef APP-PLUS*/
uni.hideTabBar({
animation: false
})
animation: false,
});
/*#endif*/
},
onHide: function() {
console.log('App Hide')
}
}
onHide: function () {
console.log("App Hide");
},
};
</script>
<style lang="scss">
@import "@/uni_modules/uview-plus/index.scss";
@import '@/uni.scss';
@import '@/common.scss';
@import "@/uni_modules/uview-plus/index.scss";
@import "@/uni.scss";
@import "@/common.scss";
.container {
.container {
padding: 15px;
}
}
.content {
display: flex;
min-width: 750rpx;
@@ -50,6 +57,7 @@
overflow: hidden;
background-color: $app-bj;
}
.content-one {
display: flex;
min-width: 750rpx;
@@ -63,125 +71,162 @@
overflow: hidden;
background-color: $app-bj;
}
.flex-r-lr{
.flex-r-lr {
display: flex;
flex-direction: row;
justify-content: space-between;
}
.flex-c-lr{
.flex-c-lr {
display: flex;
flex-direction: column;
justify-content: space-between;
}
.flex-c{
.flex-c {
display: flex;
align-items: center;
justify-content: center;
}
.flex-r-e{
.flex-r-e {
display: flex;
flex-direction: row;
justify-content: flex-end;
}
.flex-r{
.flex-r {
display: flex;
flex-direction: row;
align-items: center;
}
.flex-col{
.flex-col {
display: flex;
flex-direction: column;
}
.text-w-400{
.text-w-400 {
font-weight: 400;
}
.text-white{
color:#fff;
.text-white {
color: #fff;
}
.text-zi{
color:#7934F6;
.text-zi {
color: #7934f6;
}
.text-zu{
color:#000;
.text-zu {
color: #000;
}
.text-zu1{
color:#333;
.text-zu1 {
color: #333;
}
.text-fu{
color:#666;
.text-fu {
color: #666;
}
.text-fu1{
color:#999;
.text-fu1 {
color: #999;
}
.text-lu{
color:#00A776;
.text-lu {
color: #00a776;
}
.mt-12{
margin-top:12rpx;
.mt-12 {
margin-top: 12rpx;
}
.mt-24{
margin-top:24rpx;
.mt-24 {
margin-top: 24rpx;
}
.mb-32{
margin-bottom:32rpx;
.mb-32 {
margin-bottom: 32rpx;
}
.mt-32{
margin-top:32rpx;
.mt-32 {
margin-top: 32rpx;
}
.mt-48{
margin-top:48rpx;
.mt-48 {
margin-top: 48rpx;
}
.mt-88{
margin-top:88rpx;
.mt-88 {
margin-top: 88rpx;
}
.text-20{
font-size:20rpx;
.text-20 {
font-size: 20rpx;
}
.text-24{
font-size:24rpx;
.text-24 {
font-size: 24rpx;
}
.text-26{
font-size:26rpx;
.text-26 {
font-size: 26rpx;
}
.text-28{
font-size:28rpx;
.text-28 {
font-size: 28rpx;
}
.text-30{
font-size:30rpx;
.text-30 {
font-size: 30rpx;
}
.text-32{
font-size:32rpx;
.text-32 {
font-size: 32rpx;
}
.text-36{
font-size:36rpx;
.text-36 {
font-size: 36rpx;
}
.text-38{
font-size:38rpx;
.text-38 {
font-size: 38rpx;
}
.text-44{
font-size:44rpx;
.text-44 {
font-size: 44rpx;
}
.text-48{
font-size:48rpx;
.text-48 {
font-size: 48rpx;
}
.text-52{
font-size:52rpx;
.text-52 {
font-size: 52rpx;
}
.text-64{
font-size:64rpx;
.text-64 {
font-size: 64rpx;
}
.text-88{
font-size:88rpx;
.text-88 {
font-size: 88rpx;
}
.text-bold{
font-weight:bold;
.text-bold {
font-weight: bold;
}
.line-h{
line-height:1.2
.line-h {
line-height: 1.2;
}
.mr-32{
margin-right:32rpx;
.mr-32 {
margin-right: 32rpx;
}
.text-overflow1 {
overflow: hidden;
text-overflow: ellipsis;
@@ -190,18 +235,22 @@
line-clamp: 2;
-webkit-box-orient: vertical;
}
.text-d{
.text-d {
text-decoration: line-through;
}
.text-space{
.text-space {
white-space: nowrap;
}
button {
button {
margin-bottom: 15px;
}
img {
}
img {
width: 100%;
height: auto; /* 保持图片比例 */
}
height: auto;
/* 保持图片比例 */
}
</style>
+1
View File
@@ -134,3 +134,4 @@ export function checkAppVersion(data) {
data,
});
}
+3 -2
View File
@@ -17,8 +17,9 @@
"splashscreen" : {
"alwaysShowBeforeRender" : true,
"waiting" : true,
"autoclose" : true,
"delay" : 0
"delay" : 0,
"duration": 0,
"autoclose": false
},
/* 模块配置 */
"modules" : {
+7
View File
@@ -10,6 +10,13 @@
},
"pages": [
//pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
{
"path": "pages/order_package/launch_page/launch_page",
"style": {
"navigationStyle": "custom"
}
},
{
"path": "pages/home/home",
"style": {
+93 -55
View File
@@ -1,5 +1,5 @@
<template>
<view class="home_warp" :class="platformType ? '' : 'iosplatformType'">
<view v-if="pageReady" class="home_warp" :class="platformType ? '' : 'iosplatformType'">
<!-- 带背景的头部 -->
<view class="home_header_warp"></view>
<view class="home_content_z_warp">
@@ -239,34 +239,50 @@
</template>
<script>
import { getGoodsDetail } from "@/api/product.js";
import choiceness from "@/components/choiceness/choiceness.vue";
import { searchList } from "@/api/product.js";
import {
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 { getNewsList } from "@/api/news.js";
import { comparisonVersionHandler } from "@/utils/index.js";
import HomePopup from "@/components/common/home-popup.vue";
} 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";
import {
SHARE_URL
} from "@/utils/config.js";
export default {
components: { choiceness, CustomTabBar, HomePopup },
export default {
components: {
choiceness,
CustomTabBar,
HomePopup
},
data() {
return {
swiperList: [],
currentNum: 0,
sortList: [],
languageShow: false, // 语言选项
languageList: [
{
languageList: [{
name: "中文",
key: "CN",
},
@@ -295,11 +311,9 @@ export default {
};
},
onShow() {
/*#ifdef APP-PLUS*/
uni.hideTabBar({
animation: false,
});
/*#endif*/
// 获取设备是安卓还是ios
const appUpdate = uni.getStorageSync("platform");
const versionUpdateTime = uni.getStorageSync("versionUpdateTime");
@@ -325,19 +339,41 @@ export default {
this.getCarouselImage();
this.onNews(); // 获取公告
},
onLoad() { },
mounted() { },
onLoad() {
/*#ifdef APP-PLUS*/
uni.hideTabBar({
animation: false,
});
// 检查是否需要展示启动页
// const hasShown = getApp().globalData.launchShown;
// if (!hasShown) {
// getApp().globalData.launchShown = true; // 置为已展示
// // ⚠️ 不让首页渲染
// this.pageReady = false;
// uni.navigateTo({
// url: '/pages/order_package/launch_page/launch_page'
// });
// return; // 阻止后续渲染
// }
/*#endif*/
// 不需要启动页,才渲染首页
this.pageReady = true;
},
mounted() {},
methods: {
// 获取公告
jumpNewSearch(type) {
if (type === 'list') {
uni.navigateTo({url:"/pages/login_package/announcement/announcement"});
uni.navigateTo({
url: "/pages/login_package/announcement/announcement"
});
return;
}
uni.setStorageSync("isReadNews", this.newsList[0].id);
uni.navigateTo({
url:
"/pages/login_package/announcement-detail/announcement-detail?id=" +
url: "/pages/login_package/announcement-detail/announcement-detail?id=" +
this.newsList[0].id,
});
},
@@ -379,7 +415,7 @@ export default {
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 (
@@ -408,7 +444,7 @@ export default {
});
}
},
fail: function (err) {
fail: function(err) {
console.error("获取剪贴板内容失败", err);
},
});
@@ -432,7 +468,7 @@ export default {
localAppVersonName = uni.getStorageSync("version"),
localAppVerson = uni.getStorageSync("versionCode");
// #ifdef APP-PLUS
plus.runtime.getProperty(plus.runtime.appid, function (widgetInfo) {
plus.runtime.getProperty(plus.runtime.appid, function(widgetInfo) {
const params = {
terminal: self.platformType,
versionCode: localAppVerson,
@@ -469,20 +505,20 @@ export default {
if (platformType == "ANDROID") {
// 弹出系统等待对话框
var dtask = plus.downloader.createDownload(
updateApkObj.downloadUrl,
{},
function (d, status) {
updateApkObj.downloadUrl, {},
function(d, status) {
// 下载完成
if (status == 200) {
plus.runtime.install(
plus.io.convertLocalFileSystemURL(d.filename),
{ force: true },
function (resp) {
plus.io.convertLocalFileSystemURL(d.filename), {
force: true
},
function(resp) {
// 直接重启APP
uni.setStorageSync("versionUpdateTime", dayjs().valueOf()); // 记录升级的时间
plus.runtime.restart();
},
function (error) {
function(error) {
console.log("error", error);
uni.showToast({
title: error.message,
@@ -505,7 +541,7 @@ export default {
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:
@@ -608,7 +644,9 @@ export default {
* 查询分类列表
*/
async getSortList() {
const resp = await getCascadeCategory({ parentId: 0 });
const resp = await getCascadeCategory({
parentId: 0
});
if (resp && resp.bizcode === 100) {
this.sortList = resp.data.slice(0, 10);
}
@@ -633,11 +671,11 @@ export default {
return !useTabber(13);
},
},
};
};
</script>
<style lang="scss" scoped>
.home_warp {
.home_warp {
background: $app-bj;
height: calc(100vh - env(safe-area-inset-bottom)); // 是底部的导航栏高度
overflow: auto;
@@ -646,17 +684,17 @@ export default {
&.iosplatformType {
height: 100vh;
}
}
}
.home_header_warp {
.home_header_warp {
// background-color: #AC2A29FF;
// background: linear-gradient(0deg, $app-bj, #AC2A29FF);
background: linear-gradient(270deg, #af39c4 0%, #7732ff 100%);
height: 500rpx;
padding: 100rpx 30rpx 0rpx;
}
}
.home_content_z_warp {
.home_content_z_warp {
position: absolute;
top: 90rpx;
@@ -696,9 +734,9 @@ export default {
font-size: 28rpx;
color: #ffffffb3;
}
}
}
.logo_banner {
.logo_banner {
display: flex;
justify-content: space-between;
padding: 0 30rpx;
@@ -714,9 +752,9 @@ export default {
.logo_banner_msg {
font-size: 22rpx;
}
}
}
.home_sort_warp {
.home_sort_warp {
// position: absolute;
top: 460rpx;
padding: 30rpx 30rpx 0;
@@ -742,9 +780,9 @@ export default {
color: #333333;
}
}
}
}
.home_content_warp {
.home_content_warp {
padding: 0 30rpx;
.product_comm {
@@ -1042,9 +1080,9 @@ export default {
// margin-top: 10rpx;
}
}
}
}
.uni-banner-news {
.uni-banner-news {
width: 540rpx;
margin: 0 auto;
background: url(https://hashmall-prod.oss-cn-shenzhen.aliyuncs.com/common/image/%E9%9D%9E%E5%BC%BA%E5%88%B6%E5%8D%87%E7%BA%A7.png) no-repeat;
@@ -1105,5 +1143,5 @@ export default {
position: fixed;
bottom: 60rpx;
}
}
}
</style>
@@ -0,0 +1,108 @@
<template>
<view class="splash" v-if="show">
<!-- 宽度 = 屏幕宽,高度自适应 -->
<image
class="splash__bg"
:src="sharePoster.posterUrl"
mode="widthFix"
@tap="goDetail"
/>
<view class="splash__count" @tap.stop="goHome"> {{ count }}s 后跳过 </view>
</view>
</template>
<script>
import { getSharePoster } from "@/api/common.js";
export default {
data() {
return {
show: true, // 控制整个假启动页销毁
count: 3,
timer: null,
sharePoster: {},
};
},
async onLoad() {
const hasShown = getApp().globalData.launchShown;
if (hasShown) {
uni.switchTab({ url: "/pages/home/home" });
return;
}
getApp().globalData.launchShown = true; // 置为已展示
await this.getPoster();
this.startCountdown();
},
onUnload() {
this.clearTimer();
},
methods: {
/* 拉取海报 */
async getPoster() {
const { bizcode, data } = await getSharePoster({ type: 0 });
if (bizcode === 100 && data.length) {
this.sharePoster = data[0];
} else {
uni.switchTab({ url: "/pages/home/home" });
}
},
/* 倒计时 */
startCountdown() {
this.timer = setInterval(() => {
this.count--;
if (this.count <= 0) this.goHome();
}, 1000);
},
clearTimer() {
if (this.timer) {
clearInterval(this.timer);
this.timer = null;
}
},
/* 业务跳转 */
goHome() {
this.clearTimer();
uni.switchTab({ url: "/pages/home/home" });
},
goDetail() {
this.clearTimer();
if (this.sharePoster.id) {
uni.navigateTo({
url: `/pages/other_package/productInfo/productInfo?id=${this.sharePoster.id}&isSplash=true`,
});
} else {
uni.switchTab({ url: "/pages/home/home" });
}
},
},
};
</script>
<style scoped lang="scss">
.splash {
position: fixed;
inset: 0;
background: #000; // 防止图片透明区域露白
display: flex;
align-items: center; // 图片上下居中
justify-content: center;
&__bg {
width: 100%; // 宽度 = 屏幕宽
height: auto; // 高度自适应
display: block; // 去掉图片底部空隙
}
&__count {
position: absolute;
right: 40rpx;
top: 80rpx;
color: #fff;
font-size: 26rpx;
padding: 6rpx 16rpx;
background: rgba(0, 0, 0, 0.35);
border-radius: 20rpx;
}
}
</style>
+201 -176
View File
@@ -79,7 +79,7 @@
<!-- 暂时隐藏 -->
<view></view>
<!-- 销量还需要改 -->
<view>销量{{ orderInfo.sales }}件</view>
<view>销量{{ limit999(orderInfo.sales) }}件</view>
</view>
</view>
@@ -126,7 +126,9 @@
<view class="concrete_item_value">
<view class="address_warp">
<!-- <view style="margin-left: 10rpx">包邮</view> -->
<view style="margin-left: 10rpx">{{ postage ? `¥${postage}元` : '包邮'}}</view>
<view style="margin-left: 10rpx">{{
postage ? `¥${postage}元` : "包邮"
}}</view>
</view>
</view>
</view>
@@ -161,11 +163,13 @@
<view class="tui-view">
<text class="text-32 text-zu">退货提示</text>
<text class="text-28 text-fu1" >拆封后影响品质”或“影响二次销售的”不予退货。</text>
<text class="text-28 text-fu1"
>拆封后影响品质”或“影响二次销售的”不予退货。</text
>
<view class="tui-list">
<view class="tui-box" :key="index" v-for="(item,index) in tuiList">
<view class="tui-box" :key="index" v-for="(item, index) in tuiList">
<image :src="`/static/new/tui_${index}.png`"></image>
<text class="text-24 text-zu1">{{item}}</text>
<text class="text-24 text-zu1">{{ item }}</text>
</view>
<!-- tuiList -->
</view>
@@ -226,7 +230,13 @@
>立即购买</view
>
</view>
<MyBtn v-if="isShareUrl" mh="88rpx" text="打开APP" wd="200rpx" @ok="onOpenApp"></MyBtn>
<MyBtn
v-if="isShareUrl"
mh="88rpx"
text="打开APP"
wd="200rpx"
@ok="onOpenApp"
></MyBtn>
</view>
<!-- 选择规格的弹框 -->
<up-popup
@@ -445,15 +455,17 @@
:id="id"
:text="orderInfo.name ? orderInfo.name : ''"
:price="orderInfo.minPrice ? orderInfo.minPrice : ''"
:tu="swiperList.length && swiperList[0]"></SharePopup>
:tu="swiperList.length && swiperList[0]"
></SharePopup>
<view class="hideCanvasView">
<canvas
id="myCanvas"
canvas-id="myCanvas"
:style="{
height: ((bgObj.height) + 'px'),
width: ((bgObj.width) + 'px')
}"></canvas>
height: bgObj.height + 'px',
width: bgObj.width + 'px',
}"
></canvas>
</view>
</view>
</template>
@@ -462,12 +474,12 @@
import { getGoodsDetail, addGoods, getGoodsSpecs } from "@/api/product.js";
import { getValue, PRODUCT_DELIVERY_TIME } from "@/utils/enumUtils.js";
import { copyData } from "@/utils/index.js";
import SharePopup from "@/pages/other_package/components/share-popup.vue"
import MyBtn from '@/components/common/my-btn.vue'
import SharePopup from "@/pages/other_package/components/share-popup.vue";
import MyBtn from "@/components/common/my-btn.vue";
import { getPostageQuery } from "@/api/cart.js";
import { assembleAddress } from "@/utils/index.js";
// const QSCanvas = require('qs-canvas')
import QSCanvas from 'qs-canvas';
import QSCanvas from "qs-canvas";
// import {getSharePoster} from "@/components/QuShe-SharerPoster/QS-SharePoster/QS-SharePoster.js";
import func from "@/utils/func.js";
import Address from "@/components/address.vue";
@@ -493,15 +505,15 @@ export default {
components: {
Address,
SharePopup,
MyBtn
MyBtn,
},
data() {
return {
id: 0,
shareShow:false,
shareShow: false,
addressShow: false, // 收件地址选择
shareOpen:false,
tuiList:['破损','污渍','划痕','标签','其他'],
shareOpen: false,
tuiList: ["破损", "污渍", "划痕", "标签", "其他"],
swiperList: [],
currentNum: 0,
specificationShow: false,
@@ -518,22 +530,25 @@ export default {
selectAddress: {}, // 选择的地址
postage: null, // 邮费
adressInfo: "",
urlPath:'',
posterImage:'',
canvasId: 'default_PosterCanvasId',
poster:'',
urlPath: "",
posterImage: "",
canvasId: "default_PosterCanvasId",
poster: "",
bgObj: {
height: 480,
width: 310
width: 310,
},
draw:null,
tmpImg:'',
isShareUrl:false
draw: null,
tmpImg: "",
isShareUrl: false,
isSplash: false,
};
},
onLoad(options) {
const id = options.id;
const source = options.source;
this.isSplash = options.isSplash;
console.log("isSplash", this.isSplash == "true");
if (id && id !== 0) {
this.id = id ? parseInt(id, 10) : 0;
@@ -547,48 +562,52 @@ export default {
// #ifdef H5
let url = window.location.href;
if(url.indexOf(SHARE_URL) != -1){
if (url.indexOf(SHARE_URL) != -1) {
this.isShareUrl = true;
}
console.log('url',url,SHARE_URL)
console.log("url", url, SHARE_URL);
// #endif
qsc = new QSCanvas({
canvasId: 'myCanvas',
setCanvasWH: bg => {
this.bgObj = bg
}
}, this);
qsc = new QSCanvas(
{
canvasId: "myCanvas",
setCanvasWH: (bg) => {
this.bgObj = bg;
},
onHide(){
},
this
);
},
onHide() {
timer && clearTimeout(timer);
timer = null;
},
onUnload(){
onUnload() {
timer && clearTimeout(timer);
timer = null;
},
methods: {
assembleAddress,
onOpenApp(){
limit999(n) {
return n > 999 ? '999+' : String(n);
},
onOpenApp() {
//https://download.tbmall.xin/1002/apppacket/20251113/20251113183449483.apk
let iphone = this.iosOrAnd();
window.location = 'trustbridgeapp://';
timer = setTimeout(()=>{
if(timer != null){
window.location = "trustbridgeapp://";
timer = setTimeout(() => {
if (timer != null) {
uni.showModal({
title:'未成功唤起APP',
content:'是否前往下载?',
success:(res=>{
if(res.confirm){
window.open('https://app.tbmall.xin')
title: "未成功唤起APP",
content: "是否前往下载?",
success: (res) => {
if (res.confirm) {
window.open("https://app.tbmall.xin");
}
})
})
},
});
}
},3000)
}, 3000);
},
iosOrAnd() {
let userAgent = navigator.userAgent || navigator.vendor || window.opera;
@@ -601,7 +620,7 @@ export default {
return "Other";
},
onZiXun() {
if(this.isShareUrl){
if (this.isShareUrl) {
return;
}
uni.navigateTo({
@@ -609,71 +628,67 @@ export default {
});
},
getValue,
onShare(index){
onShare(index) {
let tmp = `【信任桥】消费共享数字化权益 ${SHARE_URL}/#/pages/other_package/productInfo/productInfo?id=${this.id} ${this.orderInfo.name}`;
if(index == 0){
if (index == 0) {
// WXSceneTimeline
uni.share({
provider:'weixin',
scene:'WXSceneSession',
type:1,
summary:tmp,
})
this.onClose()
}else if(index == 1){
provider: "weixin",
scene: "WXSceneSession",
type: 1,
summary: tmp,
});
this.onClose();
} else if (index == 1) {
uni.share({
provider:'weixin',
scene:'WXSceneTimeline',
type:1,
summary:tmp,
})
}else if(index == 2){
this.onClose()
}else if(index == 3){
setTimeout(()=>{
provider: "weixin",
scene: "WXSceneTimeline",
type: 1,
summary: tmp,
});
} else if (index == 2) {
this.onClose();
} else if (index == 3) {
setTimeout(() => {
this.onDraw();
},1000)
this.onClose()
}else if(index == 4){
return func.myToast('暂未开放');
}, 1000);
this.onClose();
} else if (index == 4) {
return func.myToast("暂未开放");
uni.share({
provider:'qq',
type:1,
summary:tmp,
})
provider: "qq",
type: 1,
summary: tmp,
});
}
},
async onDraw(){
async onDraw() {
let _this = this;
try {
let last
let last;
// qsc.setRect({ x: 0, y: 0,r:12, height: 960, width: 620});
qsc.setPaintbrush({
strokeStyle:'#EBEBEB',
strokeStyle: "#EBEBEB",
font: {
fontSize: 16
}
})
fontSize: 16,
},
});
last = await qsc.drawImg({
val: 'https://cex-pub.s3.ap-southeast-1.amazonaws.com/static/new/di.png',
val: "https://cex-pub.s3.ap-southeast-1.amazonaws.com/static/new/di.png",
x: 0,
y: 0,
height: 480,
width: 310,
})
});
last = await qsc.drawImg({
val: 'https://cex-pub.s3.ap-southeast-1.amazonaws.com/static/new/logo.png',
val: "https://cex-pub.s3.ap-southeast-1.amazonaws.com/static/new/logo.png",
x: 228,
y: 393,
height: 62,
width: 62,
})
});
// last = await qsc.drawImg({
// val:'https://niu8.letaocm.top/17557729915067836.jpg',
@@ -685,37 +700,37 @@ export default {
// #ifndef H5
last = await qsc.drawImg({
val:_this.swiperList[0],
val: _this.swiperList[0],
x: 20,
y: 20,
height: 270,
width: 270,
})
});
// #endif
qsc.setPaintbrush({
strokeStyle:'#EBEBEB'
})
strokeStyle: "#EBEBEB",
});
// { x1: obj.x, y1: y, x2: obj.x + tw, y2: y, style, gap, width, color }
last = await qsc.drawLine({
style:'solide',
x1:210,
y1:313,
x2:210,
y2:342,
width:1,
gap:1
})
style: "solide",
x1: 210,
y1: 313,
x2: 210,
y2: 342,
width: 1,
gap: 1,
});
last = await qsc.drawLine({
style:'solide',
x1:20,
y1:368,
x2:290,
y2:368,
width:1,
gap:1
})
style: "solide",
x1: 20,
y1: 368,
x2: 290,
y2: 368,
width: 1,
gap: 1,
});
// last = await qsc.drawImg({
// val:'https://hashmall-prod.oss-cn-shenzhen.aliyuncs.com/1002/image/20250818/20250818134614672.jpg',
@@ -730,44 +745,52 @@ export default {
x: 20,
y: 310,
maxWidth: 180,
line: 2
})
line: 2,
});
last = await qsc.drawText({
val: '1、保存图片到相册',
val: "1、保存图片到相册",
x: 93,
y: 397,
paintbrushProps: { fillStyle: '#7f7f7f',font: { fontSize: 12, fontWeight: 400 } } ,
})
paintbrushProps: {
fillStyle: "#7f7f7f",
font: { fontSize: 12, fontWeight: 400 },
},
});
last = await qsc.drawText({
val: '2、扫一扫下载信任桥',
val: "2、扫一扫下载信任桥",
x: 93,
y: 438,
paintbrushProps: { fillStyle: '#7f7f7f',font: { fontSize: 12, fontWeight: 400 } } ,
})
paintbrushProps: {
fillStyle: "#7f7f7f",
font: { fontSize: 12, fontWeight: 400 },
},
});
last = await qsc.drawText({
val: '¥' + this.orderInfo.minPrice,
val: "¥" + this.orderInfo.minPrice,
x: 230,
y: 317,
paintbrushProps: { fillStyle: '#7A35F6',font: { fontSize: 20, fontWeight: 700 } } ,
})
paintbrushProps: {
fillStyle: "#7A35F6",
font: { fontSize: 20, fontWeight: 700 },
},
});
last = await qsc.drawQrCode({
val: `${SHARE_URL}/#/pages/other_package/productInfo/productInfo?id=${this.id}`,
x: 20,
y: 391,
size: 65,
})
});
// await qsc.updateCanvasWH({ width: '300px', height: '960px'})
await qsc.draw();
setTimeout(()=>{
setTimeout(() => {
uni.canvasToTempFilePath({
canvasId: 'myCanvas',
canvasId: "myCanvas",
success: function (res) {
const tempFilePath = res.tempFilePath;
_this.tmpImg = tempFilePath;
@@ -776,48 +799,47 @@ export default {
uni.downloadFile({
url: tempFilePath,
success: function () {
let link = document.createElement('a');
let link = document.createElement("a");
link.href = tempFilePath;
link.download = '分享图片';
link.download = "分享图片";
link.click();
},
fail: function (err) {
uni.showToast({
title: '保存失败',
icon: 'none',
duration: 2000
title: "保存失败",
icon: "none",
duration: 2000,
});
}
},
});
// #endif
// #ifndef H5
uni.saveImageToPhotosAlbum({
filePath: tempFilePath,
success: function () {
uni.showToast({
title: '保存成功',
icon: 'success',
duration: 2000
title: "保存成功",
icon: "success",
duration: 2000,
});
},
fail: function (err) {
console.error('保存失败:', err);
console.error("保存失败:", err);
uni.showModal({
title: '错误',
content: '保存图片到相册失败',
showCancel: false
title: "错误",
content: "保存图片到相册失败",
showCancel: false,
});
}
},
});
// #endif
},
fail: function (error) {
console.error('获取图片失败:', error);
}
console.error("获取图片失败:", error);
},
});
},200)
}, 200);
// let img = await qsc.toImage({x:0,y:0,width:620,height:960,
// destWidth:310 * 4,destHeight:480 * 4,fileType:'png'});
@@ -825,17 +847,17 @@ export default {
// console.log('img',img)
} catch (e) {
//TODO handle the exception
console.log('绘制异常',e)
console.log("绘制异常", e);
uni.showModal({
content: JSON.stringify(e)
})
content: JSON.stringify(e),
});
}
},
onClose(){
onClose() {
this.shareShow = false;
setTimeout(()=>{
setTimeout(() => {
this.shareOpen = false;
},1000)
}, 1000);
},
onSwiper(index) {
uni.previewImage({
@@ -845,7 +867,7 @@ export default {
});
},
jumpAddAddress() {
if(this.isShareUrl){
if (this.isShareUrl) {
return;
}
this.addressShow = true;
@@ -895,12 +917,16 @@ export default {
this.openShow = false;
},
jumpLeft() {
if (this.isSplash == "true") {
uni.switchTab({ url: "/pages/home/home" });
return;
}
uni.navigateBack({
delta: 1, // 返回的页面数,默认为1,返回到上一级
});
},
jumpOther(type) {
if(this.isShareUrl){
if (this.isShareUrl) {
return;
}
if (type === "home") {
@@ -992,7 +1018,7 @@ export default {
});
},
async checkSpecification(val, type) {
if(this.isShareUrl){
if (this.isShareUrl) {
return;
}
const source = this.source;
@@ -1181,10 +1207,9 @@ export default {
},
// 跳转到分享页面
jumpShare() {
console.log('jumpShare')
console.log("jumpShare");
this.shareOpen = true;
this.shareShow = true;
},
},
};
@@ -1290,36 +1315,36 @@ export default {
margin-top: 10rpx;
}
.tui-view{
width:100%;
height:286rpx;
min-height:286rpx;
.tui-view {
width: 100%;
height: 286rpx;
min-height: 286rpx;
background-color: #fff;
border-radius: 24rpx;
display: flex;
flex-direction: column;
padding: 32rpx;
box-sizing: border-box;
margin-top:24rpx;
.tui-list{
width:100%;
height:104rpx;
min-height:104rpx;
margin-top: 24rpx;
.tui-list {
width: 100%;
height: 104rpx;
min-height: 104rpx;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
margin-top:24rpx;
.tui-box{
width:64rpx;
min-height:100%;
margin-top: 24rpx;
.tui-box {
width: 64rpx;
min-height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
image{
width:64rpx;
height:64rpx;
image {
width: 64rpx;
height: 64rpx;
}
}
}
@@ -1694,12 +1719,12 @@ export default {
}
}
}
.hideCanvasView{
width:100%;
height:100%;
.hideCanvasView {
width: 100%;
height: 100%;
position: fixed;
top:10000;
left:10000;
top: 10000;
left: 10000;
z-index: 1000000000000;
// background-color: rgba(0,0,0,0.2);
display: flex;