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", "playground" : "standard",
"type" : "uni-app:app-ios" "type" : "uni-app:app-ios"
},
{
"customPlaygroundType" : "device",
"playground" : "standard",
"type" : "uni-app:app-ios_simulator"
} }
] ]
} }
+67 -18
View File
@@ -1,42 +1,49 @@
<script> <script>
export default { export default {
globalData: {
launchShown: false, // 内存标记,杀进程就清空
},
onLaunch: function () { onLaunch: function () {
console.log('App Launch') console.log("App Launch");
const res = uni.getSystemInfoSync(); const res = uni.getSystemInfoSync();
uni.setStorageSync('platform', res.platform); uni.setStorageSync("platform", res.platform);
// #ifdef APP-PLUS          // #ifdef APP-PLUS
plus.navigator.closeSplashscreen(); // 立即关闭原生闪屏
// 获取应用版本信息 // 获取应用版本信息
plus.runtime.getProperty(plus.runtime.appid, function (inf) { plus.runtime.getProperty(plus.runtime.appid, function (inf) {
console.log("版本信息",inf.versionCode) console.log("版本信息", inf.versionCode);
uni.setStorageSync('version-1', inf.version); // 大版本号 uni.setStorageSync("version-1", inf.version); // 大版本号
uni.setStorageSync('versionCode', inf.versionCode); // 小版本号 uni.setStorageSync("versionCode", inf.versionCode); // 小版本号
}); });
let uuid = plus.device.uuid; let uuid = plus.device.uuid;
// #endif // #endif
}, },
onShow: function () { onShow: function () {
console.log('App Show') console.log("App Show");
// 隐藏原生tabbar // 隐藏原生tabbar
/*#ifdef APP-PLUS*/ /*#ifdef APP-PLUS*/
uni.hideTabBar({ uni.hideTabBar({
animation: false animation: false,
}) });
/*#endif*/ /*#endif*/
}, },
onHide: function () { onHide: function () {
console.log('App Hide') console.log("App Hide");
} },
} };
</script> </script>
<style lang="scss"> <style lang="scss">
@import "@/uni_modules/uview-plus/index.scss"; @import "@/uni_modules/uview-plus/index.scss";
@import '@/uni.scss'; @import "@/uni.scss";
@import '@/common.scss'; @import "@/common.scss";
.container { .container {
padding: 15px; padding: 15px;
} }
.content { .content {
display: flex; display: flex;
min-width: 750rpx; min-width: 750rpx;
@@ -50,6 +57,7 @@
overflow: hidden; overflow: hidden;
background-color: $app-bj; background-color: $app-bj;
} }
.content-one { .content-one {
display: flex; display: flex;
min-width: 750rpx; min-width: 750rpx;
@@ -63,125 +71,162 @@
overflow: hidden; overflow: hidden;
background-color: $app-bj; background-color: $app-bj;
} }
.flex-r-lr { .flex-r-lr {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
justify-content: space-between; justify-content: space-between;
} }
.flex-c-lr { .flex-c-lr {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: space-between; justify-content: space-between;
} }
.flex-c { .flex-c {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
.flex-r-e { .flex-r-e {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
justify-content: flex-end; justify-content: flex-end;
} }
.flex-r { .flex-r {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
} }
.flex-col { .flex-col {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
} }
.text-w-400 { .text-w-400 {
font-weight: 400; font-weight: 400;
} }
.text-white { .text-white {
color: #fff; color: #fff;
} }
.text-zi { .text-zi {
color:#7934F6; color: #7934f6;
} }
.text-zu { .text-zu {
color: #000; color: #000;
} }
.text-zu1 { .text-zu1 {
color: #333; color: #333;
} }
.text-fu { .text-fu {
color: #666; color: #666;
} }
.text-fu1 { .text-fu1 {
color: #999; color: #999;
} }
.text-lu { .text-lu {
color:#00A776; color: #00a776;
} }
.mt-12 { .mt-12 {
margin-top: 12rpx; margin-top: 12rpx;
} }
.mt-24 { .mt-24 {
margin-top: 24rpx; margin-top: 24rpx;
} }
.mb-32 { .mb-32 {
margin-bottom: 32rpx; margin-bottom: 32rpx;
} }
.mt-32 { .mt-32 {
margin-top: 32rpx; margin-top: 32rpx;
} }
.mt-48 { .mt-48 {
margin-top: 48rpx; margin-top: 48rpx;
} }
.mt-88 { .mt-88 {
margin-top: 88rpx; margin-top: 88rpx;
} }
.text-20 { .text-20 {
font-size: 20rpx; font-size: 20rpx;
} }
.text-24 { .text-24 {
font-size: 24rpx; font-size: 24rpx;
} }
.text-26 { .text-26 {
font-size: 26rpx; font-size: 26rpx;
} }
.text-28 { .text-28 {
font-size: 28rpx; font-size: 28rpx;
} }
.text-30 { .text-30 {
font-size: 30rpx; font-size: 30rpx;
} }
.text-32 { .text-32 {
font-size: 32rpx; font-size: 32rpx;
} }
.text-36 { .text-36 {
font-size: 36rpx; font-size: 36rpx;
} }
.text-38 { .text-38 {
font-size: 38rpx; font-size: 38rpx;
} }
.text-44 { .text-44 {
font-size: 44rpx; font-size: 44rpx;
} }
.text-48 { .text-48 {
font-size: 48rpx; font-size: 48rpx;
} }
.text-52 { .text-52 {
font-size: 52rpx; font-size: 52rpx;
} }
.text-64 { .text-64 {
font-size: 64rpx; font-size: 64rpx;
} }
.text-88 { .text-88 {
font-size: 88rpx; font-size: 88rpx;
} }
.text-bold { .text-bold {
font-weight: bold; font-weight: bold;
} }
.line-h { .line-h {
line-height:1.2 line-height: 1.2;
} }
.mr-32 { .mr-32 {
margin-right: 32rpx; margin-right: 32rpx;
} }
.text-overflow1 { .text-overflow1 {
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
@@ -190,9 +235,11 @@
line-clamp: 2; line-clamp: 2;
-webkit-box-orient: vertical; -webkit-box-orient: vertical;
} }
.text-d { .text-d {
text-decoration: line-through; text-decoration: line-through;
} }
.text-space { .text-space {
white-space: nowrap; white-space: nowrap;
} }
@@ -200,8 +247,10 @@
button { button {
margin-bottom: 15px; margin-bottom: 15px;
} }
img { img {
width: 100%; width: 100%;
height: auto; /* 保持图片比例 */ height: auto;
/* 保持图片比例 */
} }
</style> </style>
+1
View File
@@ -134,3 +134,4 @@ export function checkAppVersion(data) {
data, data,
}); });
} }
+3 -2
View File
@@ -17,8 +17,9 @@
"splashscreen" : { "splashscreen" : {
"alwaysShowBeforeRender" : true, "alwaysShowBeforeRender" : true,
"waiting" : true, "waiting" : true,
"autoclose" : true, "delay" : 0,
"delay" : 0 "duration": 0,
"autoclose": false
}, },
/* 模块配置 */ /* 模块配置 */
"modules" : { "modules" : {
+7
View File
@@ -10,6 +10,13 @@
}, },
"pages": [ "pages": [
//pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
{
"path": "pages/order_package/launch_page/launch_page",
"style": {
"navigationStyle": "custom"
}
},
{ {
"path": "pages/home/home", "path": "pages/home/home",
"style": { "style": {
+62 -24
View File
@@ -1,5 +1,5 @@
<template> <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_header_warp"></view>
<view class="home_content_z_warp"> <view class="home_content_z_warp">
@@ -239,34 +239,50 @@
</template> </template>
<script> <script>
import { getGoodsDetail } from "@/api/product.js"; import {
getGoodsDetail
} from "@/api/product.js";
import choiceness from "@/components/choiceness/choiceness.vue"; import choiceness from "@/components/choiceness/choiceness.vue";
import { searchList } from "@/api/product.js"; import {
searchList
} from "@/api/product.js";
import { import {
getCascadeCategory, getCascadeCategory,
checkAppVersion, checkAppVersion,
getCarouselImage, getCarouselImage,
} from "@/api/common.js"; } from "@/api/common.js";
import { SEARCH_TYPE, APP_PAGE_TYPE } from "@/utils/enumUtils.js"; import {
SEARCH_TYPE,
APP_PAGE_TYPE
} from "@/utils/enumUtils.js";
import CustomTabBar from "@/components/custom-tab-bar.vue"; // 引入自定义组件路径可能需要根据项目结构调整 import CustomTabBar from "@/components/custom-tab-bar.vue"; // 引入自定义组件路径可能需要根据项目结构调整
import dayjs from "dayjs"; import dayjs from "dayjs";
import useTabber from "tabber-component"; import useTabber from "tabber-component";
import { getNewsList } from "@/api/news.js"; import {
import { comparisonVersionHandler } from "@/utils/index.js"; getNewsList
} from "@/api/news.js";
import {
comparisonVersionHandler
} from "@/utils/index.js";
import HomePopup from "@/components/common/home-popup.vue"; import HomePopup from "@/components/common/home-popup.vue";
import { SHARE_URL } from "@/utils/config.js"; import {
SHARE_URL
} from "@/utils/config.js";
export default { export default {
components: { choiceness, CustomTabBar, HomePopup }, components: {
choiceness,
CustomTabBar,
HomePopup
},
data() { data() {
return { return {
swiperList: [], swiperList: [],
currentNum: 0, currentNum: 0,
sortList: [], sortList: [],
languageShow: false, // 语言选项 languageShow: false, // 语言选项
languageList: [ languageList: [{
{
name: "中文", name: "中文",
key: "CN", key: "CN",
}, },
@@ -295,11 +311,9 @@ export default {
}; };
}, },
onShow() { onShow() {
/*#ifdef APP-PLUS*/
uni.hideTabBar({
animation: false,
});
/*#endif*/
// 获取设备是安卓还是ios // 获取设备是安卓还是ios
const appUpdate = uni.getStorageSync("platform"); const appUpdate = uni.getStorageSync("platform");
const versionUpdateTime = uni.getStorageSync("versionUpdateTime"); const versionUpdateTime = uni.getStorageSync("versionUpdateTime");
@@ -325,19 +339,41 @@ export default {
this.getCarouselImage(); this.getCarouselImage();
this.onNews(); // 获取公告 this.onNews(); // 获取公告
}, },
onLoad() { }, 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() {}, mounted() {},
methods: { methods: {
// 获取公告 // 获取公告
jumpNewSearch(type) { jumpNewSearch(type) {
if (type === 'list') { if (type === 'list') {
uni.navigateTo({url:"/pages/login_package/announcement/announcement"}); uni.navigateTo({
url: "/pages/login_package/announcement/announcement"
});
return; return;
} }
uni.setStorageSync("isReadNews", this.newsList[0].id); uni.setStorageSync("isReadNews", this.newsList[0].id);
uni.navigateTo({ uni.navigateTo({
url: url: "/pages/login_package/announcement-detail/announcement-detail?id=" +
"/pages/login_package/announcement-detail/announcement-detail?id=" +
this.newsList[0].id, this.newsList[0].id,
}); });
}, },
@@ -469,14 +505,14 @@ export default {
if (platformType == "ANDROID") { if (platformType == "ANDROID") {
// 弹出系统等待对话框 // 弹出系统等待对话框
var dtask = plus.downloader.createDownload( var dtask = plus.downloader.createDownload(
updateApkObj.downloadUrl, updateApkObj.downloadUrl, {},
{},
function(d, status) { function(d, status) {
// 下载完成 // 下载完成
if (status == 200) { if (status == 200) {
plus.runtime.install( plus.runtime.install(
plus.io.convertLocalFileSystemURL(d.filename), plus.io.convertLocalFileSystemURL(d.filename), {
{ force: true }, force: true
},
function(resp) { function(resp) {
// 直接重启APP // 直接重启APP
uni.setStorageSync("versionUpdateTime", dayjs().valueOf()); // 记录升级的时间 uni.setStorageSync("versionUpdateTime", dayjs().valueOf()); // 记录升级的时间
@@ -608,7 +644,9 @@ export default {
* 查询分类列表 * 查询分类列表
*/ */
async getSortList() { async getSortList() {
const resp = await getCascadeCategory({ parentId: 0 }); const resp = await getCascadeCategory({
parentId: 0
});
if (resp && resp.bizcode === 100) { if (resp && resp.bizcode === 100) {
this.sortList = resp.data.slice(0, 10); this.sortList = resp.data.slice(0, 10);
} }
@@ -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>
+136 -111
View File
@@ -79,7 +79,7 @@
<!-- 暂时隐藏 --> <!-- 暂时隐藏 -->
<view></view> <view></view>
<!-- 销量还需要改 --> <!-- 销量还需要改 -->
<view>销量{{ orderInfo.sales }}件</view> <view>销量{{ limit999(orderInfo.sales) }}件</view>
</view> </view>
</view> </view>
@@ -126,7 +126,9 @@
<view class="concrete_item_value"> <view class="concrete_item_value">
<view class="address_warp"> <view class="address_warp">
<!-- <view style="margin-left: 10rpx">包邮</view> --> <!-- <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> </view>
</view> </view>
@@ -161,7 +163,9 @@
<view class="tui-view"> <view class="tui-view">
<text class="text-32 text-zu">退货提示</text> <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-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> <image :src="`/static/new/tui_${index}.png`"></image>
@@ -226,7 +230,13 @@
>立即购买</view >立即购买</view
> >
</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> </view>
<!-- 选择规格的弹框 --> <!-- 选择规格的弹框 -->
<up-popup <up-popup
@@ -445,15 +455,17 @@
:id="id" :id="id"
:text="orderInfo.name ? orderInfo.name : ''" :text="orderInfo.name ? orderInfo.name : ''"
:price="orderInfo.minPrice ? orderInfo.minPrice : ''" :price="orderInfo.minPrice ? orderInfo.minPrice : ''"
:tu="swiperList.length && swiperList[0]"></SharePopup> :tu="swiperList.length && swiperList[0]"
></SharePopup>
<view class="hideCanvasView"> <view class="hideCanvasView">
<canvas <canvas
id="myCanvas" id="myCanvas"
canvas-id="myCanvas" canvas-id="myCanvas"
:style="{ :style="{
height: ((bgObj.height) + 'px'), height: bgObj.height + 'px',
width: ((bgObj.width) + 'px') width: bgObj.width + 'px',
}"></canvas> }"
></canvas>
</view> </view>
</view> </view>
</template> </template>
@@ -462,12 +474,12 @@
import { getGoodsDetail, addGoods, getGoodsSpecs } from "@/api/product.js"; import { getGoodsDetail, addGoods, getGoodsSpecs } from "@/api/product.js";
import { getValue, PRODUCT_DELIVERY_TIME } from "@/utils/enumUtils.js"; import { getValue, PRODUCT_DELIVERY_TIME } from "@/utils/enumUtils.js";
import { copyData } from "@/utils/index.js"; import { copyData } from "@/utils/index.js";
import SharePopup from "@/pages/other_package/components/share-popup.vue" import SharePopup from "@/pages/other_package/components/share-popup.vue";
import MyBtn from '@/components/common/my-btn.vue' import MyBtn from "@/components/common/my-btn.vue";
import { getPostageQuery } from "@/api/cart.js"; import { getPostageQuery } from "@/api/cart.js";
import { assembleAddress } from "@/utils/index.js"; import { assembleAddress } from "@/utils/index.js";
// const QSCanvas = require('qs-canvas') // 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 {getSharePoster} from "@/components/QuShe-SharerPoster/QS-SharePoster/QS-SharePoster.js";
import func from "@/utils/func.js"; import func from "@/utils/func.js";
import Address from "@/components/address.vue"; import Address from "@/components/address.vue";
@@ -493,7 +505,7 @@ export default {
components: { components: {
Address, Address,
SharePopup, SharePopup,
MyBtn MyBtn,
}, },
data() { data() {
return { return {
@@ -501,7 +513,7 @@ export default {
shareShow: false, shareShow: false,
addressShow: false, // 收件地址选择 addressShow: false, // 收件地址选择
shareOpen: false, shareOpen: false,
tuiList:['破损','污渍','划痕','标签','其他'], tuiList: ["破损", "污渍", "划痕", "标签", "其他"],
swiperList: [], swiperList: [],
currentNum: 0, currentNum: 0,
specificationShow: false, specificationShow: false,
@@ -518,22 +530,25 @@ export default {
selectAddress: {}, // 选择的地址 selectAddress: {}, // 选择的地址
postage: null, // 邮费 postage: null, // 邮费
adressInfo: "", adressInfo: "",
urlPath:'', urlPath: "",
posterImage:'', posterImage: "",
canvasId: 'default_PosterCanvasId', canvasId: "default_PosterCanvasId",
poster:'', poster: "",
bgObj: { bgObj: {
height: 480, height: 480,
width: 310 width: 310,
}, },
draw: null, draw: null,
tmpImg:'', tmpImg: "",
isShareUrl:false isShareUrl: false,
isSplash: false,
}; };
}, },
onLoad(options) { onLoad(options) {
const id = options.id; const id = options.id;
const source = options.source; const source = options.source;
this.isSplash = options.isSplash;
console.log("isSplash", this.isSplash == "true");
if (id && id !== 0) { if (id && id !== 0) {
this.id = id ? parseInt(id, 10) : 0; this.id = id ? parseInt(id, 10) : 0;
@@ -550,16 +565,17 @@ export default {
if (url.indexOf(SHARE_URL) != -1) { if (url.indexOf(SHARE_URL) != -1) {
this.isShareUrl = true; this.isShareUrl = true;
} }
console.log('url',url,SHARE_URL) console.log("url", url, SHARE_URL);
// #endif // #endif
qsc = new QSCanvas({ qsc = new QSCanvas(
canvasId: 'myCanvas', {
setCanvasWH: bg => { canvasId: "myCanvas",
this.bgObj = bg setCanvasWH: (bg) => {
} this.bgObj = bg;
}, this); },
},
this
);
}, },
onHide() { onHide() {
timer && clearTimeout(timer); timer && clearTimeout(timer);
@@ -571,24 +587,27 @@ export default {
}, },
methods: { methods: {
assembleAddress, assembleAddress,
limit999(n) {
return n > 999 ? '999+' : String(n);
},
onOpenApp() { onOpenApp() {
//https://download.tbmall.xin/1002/apppacket/20251113/20251113183449483.apk //https://download.tbmall.xin/1002/apppacket/20251113/20251113183449483.apk
let iphone = this.iosOrAnd(); let iphone = this.iosOrAnd();
window.location = 'trustbridgeapp://'; window.location = "trustbridgeapp://";
timer = setTimeout(() => { timer = setTimeout(() => {
if (timer != null) { if (timer != null) {
uni.showModal({ uni.showModal({
title:'未成功唤起APP', title: "未成功唤起APP",
content:'是否前往下载?', content: "是否前往下载?",
success:(res=>{ success: (res) => {
if (res.confirm) { if (res.confirm) {
window.open('https://app.tbmall.xin') window.open("https://app.tbmall.xin");
} }
}) },
}) });
} }
},3000) }, 3000);
}, },
iosOrAnd() { iosOrAnd() {
let userAgent = navigator.userAgent || navigator.vendor || window.opera; let userAgent = navigator.userAgent || navigator.vendor || window.opera;
@@ -614,66 +633,62 @@ export default {
if (index == 0) { if (index == 0) {
// WXSceneTimeline // WXSceneTimeline
uni.share({ uni.share({
provider:'weixin', provider: "weixin",
scene:'WXSceneSession', scene: "WXSceneSession",
type: 1, type: 1,
summary: tmp, summary: tmp,
});
}) this.onClose();
this.onClose()
} else if (index == 1) { } else if (index == 1) {
uni.share({ uni.share({
provider:'weixin', provider: "weixin",
scene:'WXSceneTimeline', scene: "WXSceneTimeline",
type: 1, type: 1,
summary: tmp, summary: tmp,
});
})
} else if (index == 2) { } else if (index == 2) {
this.onClose();
this.onClose()
} else if (index == 3) { } else if (index == 3) {
setTimeout(() => { setTimeout(() => {
this.onDraw(); this.onDraw();
},1000) }, 1000);
this.onClose() this.onClose();
} else if (index == 4) { } else if (index == 4) {
return func.myToast('暂未开放'); return func.myToast("暂未开放");
uni.share({ uni.share({
provider:'qq', provider: "qq",
type: 1, type: 1,
summary: tmp, summary: tmp,
});
})
} }
}, },
async onDraw() { async onDraw() {
let _this = this; let _this = this;
try { try {
let last let last;
// qsc.setRect({ x: 0, y: 0,r:12, height: 960, width: 620}); // qsc.setRect({ x: 0, y: 0,r:12, height: 960, width: 620});
qsc.setPaintbrush({ qsc.setPaintbrush({
strokeStyle:'#EBEBEB', strokeStyle: "#EBEBEB",
font: { font: {
fontSize: 16 fontSize: 16,
} },
}) });
last = await qsc.drawImg({ 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, x: 0,
y: 0, y: 0,
height: 480, height: 480,
width: 310, width: 310,
}) });
last = await qsc.drawImg({ 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, x: 228,
y: 393, y: 393,
height: 62, height: 62,
width: 62, width: 62,
}) });
// last = await qsc.drawImg({ // last = await qsc.drawImg({
// val:'https://niu8.letaocm.top/17557729915067836.jpg', // val:'https://niu8.letaocm.top/17557729915067836.jpg',
@@ -690,32 +705,32 @@ export default {
y: 20, y: 20,
height: 270, height: 270,
width: 270, width: 270,
}) });
// #endif // #endif
qsc.setPaintbrush({ qsc.setPaintbrush({
strokeStyle:'#EBEBEB' strokeStyle: "#EBEBEB",
}) });
// { x1: obj.x, y1: y, x2: obj.x + tw, y2: y, style, gap, width, color } // { x1: obj.x, y1: y, x2: obj.x + tw, y2: y, style, gap, width, color }
last = await qsc.drawLine({ last = await qsc.drawLine({
style:'solide', style: "solide",
x1: 210, x1: 210,
y1: 313, y1: 313,
x2: 210, x2: 210,
y2: 342, y2: 342,
width: 1, width: 1,
gap:1 gap: 1,
}) });
last = await qsc.drawLine({ last = await qsc.drawLine({
style:'solide', style: "solide",
x1: 20, x1: 20,
y1: 368, y1: 368,
x2: 290, x2: 290,
y2: 368, y2: 368,
width: 1, width: 1,
gap:1 gap: 1,
}) });
// last = await qsc.drawImg({ // last = await qsc.drawImg({
// val:'https://hashmall-prod.oss-cn-shenzhen.aliyuncs.com/1002/image/20250818/20250818134614672.jpg', // val:'https://hashmall-prod.oss-cn-shenzhen.aliyuncs.com/1002/image/20250818/20250818134614672.jpg',
@@ -730,44 +745,52 @@ export default {
x: 20, x: 20,
y: 310, y: 310,
maxWidth: 180, maxWidth: 180,
line: 2 line: 2,
}) });
last = await qsc.drawText({ last = await qsc.drawText({
val: '1、保存图片到相册', val: "1、保存图片到相册",
x: 93, x: 93,
y: 397, y: 397,
paintbrushProps: { fillStyle: '#7f7f7f',font: { fontSize: 12, fontWeight: 400 } } , paintbrushProps: {
}) fillStyle: "#7f7f7f",
font: { fontSize: 12, fontWeight: 400 },
},
});
last = await qsc.drawText({ last = await qsc.drawText({
val: '2、扫一扫下载信任桥', val: "2、扫一扫下载信任桥",
x: 93, x: 93,
y: 438, y: 438,
paintbrushProps: { fillStyle: '#7f7f7f',font: { fontSize: 12, fontWeight: 400 } } , paintbrushProps: {
}) fillStyle: "#7f7f7f",
font: { fontSize: 12, fontWeight: 400 },
},
});
last = await qsc.drawText({ last = await qsc.drawText({
val: '¥' + this.orderInfo.minPrice, val: "¥" + this.orderInfo.minPrice,
x: 230, x: 230,
y: 317, y: 317,
paintbrushProps: { fillStyle: '#7A35F6',font: { fontSize: 20, fontWeight: 700 } } , paintbrushProps: {
}) fillStyle: "#7A35F6",
font: { fontSize: 20, fontWeight: 700 },
},
});
last = await qsc.drawQrCode({ last = await qsc.drawQrCode({
val: `${SHARE_URL}/#/pages/other_package/productInfo/productInfo?id=${this.id}`, val: `${SHARE_URL}/#/pages/other_package/productInfo/productInfo?id=${this.id}`,
x: 20, x: 20,
y: 391, y: 391,
size: 65, size: 65,
}) });
// await qsc.updateCanvasWH({ width: '300px', height: '960px'}) // await qsc.updateCanvasWH({ width: '300px', height: '960px'})
await qsc.draw(); await qsc.draw();
setTimeout(() => { setTimeout(() => {
uni.canvasToTempFilePath({ uni.canvasToTempFilePath({
canvasId: 'myCanvas', canvasId: "myCanvas",
success: function (res) { success: function (res) {
const tempFilePath = res.tempFilePath; const tempFilePath = res.tempFilePath;
_this.tmpImg = tempFilePath; _this.tmpImg = tempFilePath;
@@ -776,48 +799,47 @@ export default {
uni.downloadFile({ uni.downloadFile({
url: tempFilePath, url: tempFilePath,
success: function () { success: function () {
let link = document.createElement('a'); let link = document.createElement("a");
link.href = tempFilePath; link.href = tempFilePath;
link.download = '分享图片'; link.download = "分享图片";
link.click(); link.click();
}, },
fail: function (err) { fail: function (err) {
uni.showToast({ uni.showToast({
title: '保存失败', title: "保存失败",
icon: 'none', icon: "none",
duration: 2000 duration: 2000,
}); });
} },
}); });
// #endif // #endif
// #ifndef H5 // #ifndef H5
uni.saveImageToPhotosAlbum({ uni.saveImageToPhotosAlbum({
filePath: tempFilePath, filePath: tempFilePath,
success: function () { success: function () {
uni.showToast({ uni.showToast({
title: '保存成功', title: "保存成功",
icon: 'success', icon: "success",
duration: 2000 duration: 2000,
}); });
}, },
fail: function (err) { fail: function (err) {
console.error('保存失败:', err); console.error("保存失败:", err);
uni.showModal({ uni.showModal({
title: '错误', title: "错误",
content: '保存图片到相册失败', content: "保存图片到相册失败",
showCancel: false showCancel: false,
}); });
} },
}); });
// #endif // #endif
}, },
fail: function (error) { fail: function (error) {
console.error('获取图片失败:', error); console.error("获取图片失败:", error);
} },
}); });
},200) }, 200);
// let img = await qsc.toImage({x:0,y:0,width:620,height:960, // let img = await qsc.toImage({x:0,y:0,width:620,height:960,
// destWidth:310 * 4,destHeight:480 * 4,fileType:'png'}); // destWidth:310 * 4,destHeight:480 * 4,fileType:'png'});
@@ -825,17 +847,17 @@ export default {
// console.log('img',img) // console.log('img',img)
} catch (e) { } catch (e) {
//TODO handle the exception //TODO handle the exception
console.log('绘制异常',e) console.log("绘制异常", e);
uni.showModal({ uni.showModal({
content: JSON.stringify(e) content: JSON.stringify(e),
}) });
} }
}, },
onClose() { onClose() {
this.shareShow = false; this.shareShow = false;
setTimeout(() => { setTimeout(() => {
this.shareOpen = false; this.shareOpen = false;
},1000) }, 1000);
}, },
onSwiper(index) { onSwiper(index) {
uni.previewImage({ uni.previewImage({
@@ -895,6 +917,10 @@ export default {
this.openShow = false; this.openShow = false;
}, },
jumpLeft() { jumpLeft() {
if (this.isSplash == "true") {
uni.switchTab({ url: "/pages/home/home" });
return;
}
uni.navigateBack({ uni.navigateBack({
delta: 1, // 返回的页面数,默认为1,返回到上一级 delta: 1, // 返回的页面数,默认为1,返回到上一级
}); });
@@ -1181,10 +1207,9 @@ export default {
}, },
// 跳转到分享页面 // 跳转到分享页面
jumpShare() { jumpShare() {
console.log('jumpShare') console.log("jumpShare");
this.shareOpen = true; this.shareOpen = true;
this.shareShow = true; this.shareShow = true;
}, },
}, },
}; };