动态加载图片
This commit is contained in:
parent
e9ccd71781
commit
2bd2293384
10
README.md
Normal file
10
README.md
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
#
|
||||
|
||||
##
|
||||
|
||||
```sh
|
||||
# .vue 获取图片
|
||||
<image src="@@:static" />
|
||||
# css
|
||||
src: url("@@:static/fonts/JiangChengYuanTi-700W.ttf") format("truetype");
|
||||
```
|
||||
111
common/utils.js
Normal file
111
common/utils.js
Normal file
|
|
@ -0,0 +1,111 @@
|
|||
/**
|
||||
* 延迟执行
|
||||
* @param {Number} ms
|
||||
* @returns
|
||||
*/
|
||||
export function sleep(ms) {
|
||||
return new Promise(resolve => setTimeout(resolve, ms));
|
||||
}
|
||||
/**
|
||||
* 解析查询字符串
|
||||
* @param {string} urlOrQueryString
|
||||
* @returns {Object} 查询参数对象
|
||||
*/
|
||||
export function parseQueryString(urlOrQueryString) {
|
||||
// 如果传入的是完整URL(如 "/path?name=value"),提取查询部分
|
||||
let queryString = urlOrQueryString;
|
||||
const questionMarkIndex = queryString.indexOf('?');
|
||||
if (questionMarkIndex !== -1) {
|
||||
queryString = queryString.slice(questionMarkIndex + 1);
|
||||
}
|
||||
|
||||
const params = {};
|
||||
if (!queryString) return params; // 如果没有查询参数,返回空对象
|
||||
|
||||
const pairs = queryString.split('&');
|
||||
for (const pair of pairs) {
|
||||
const [key, value] = pair.split('=');
|
||||
// 解码 URI 组件,并处理无值情况(如 "key" 而不是 "key=value")
|
||||
params[key] = value ? decodeURIComponent(value) : '';
|
||||
}
|
||||
|
||||
return params;
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示确认弹窗
|
||||
* @param {Object} options 弹窗选项
|
||||
* @param {String} options.title 弹窗标题
|
||||
* @param {String} options.content 弹窗内容
|
||||
* @param {String} options.confirmText 确认按钮文字
|
||||
* @param {String} options.cancelText 取消按钮文字
|
||||
* @returns {Promise} 返回Promise对象,resolve中返回{confirm: Boolean},表示是否点击了确认按钮
|
||||
*/
|
||||
export function showModal(options = {}) {
|
||||
return new Promise((resolve) => {
|
||||
uni.showModal({
|
||||
title: options.title || '提示',
|
||||
content: options.content || '',
|
||||
confirmText: options.confirmText || '确定',
|
||||
cancelText: options.cancelText || '取消',
|
||||
success(res) {
|
||||
resolve(res);
|
||||
},
|
||||
fail() {
|
||||
resolve({
|
||||
confirm: false
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示提示信息
|
||||
* @param {*} title 提示信息
|
||||
* @param {*} icon 图标
|
||||
* @param {*} duration 提示时长
|
||||
* @returns
|
||||
*/
|
||||
export function showToast(title, icon = "none", duration = 1500) {
|
||||
return new Promise((resolve) => {
|
||||
uni.showToast({
|
||||
title: title || '',
|
||||
icon: icon || 'none',
|
||||
duration: duration,
|
||||
success: () => {
|
||||
resolve(true);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示加载中
|
||||
* @param {String} title 加载中文字
|
||||
* @returns {Promise} 返回Promise对象,resolve中返回true
|
||||
*/
|
||||
export function showLoading(title = "加载中...") {
|
||||
return new Promise((resolve) => {
|
||||
uni.showLoading({
|
||||
title: title,
|
||||
success: () => {
|
||||
resolve(true);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 隐藏加载中
|
||||
* @returns {Promise} 返回Promise对象,resolve中返回true
|
||||
*/
|
||||
export function hideLoading() {
|
||||
return new Promise((resolve) => {
|
||||
uni.hideLoading({
|
||||
success: () => {
|
||||
resolve(true);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
14
components.d.ts
vendored
Normal file
14
components.d.ts
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
/* eslint-disable */
|
||||
// @ts-nocheck
|
||||
// Generated by unplugin-vue-components
|
||||
// Read more: https://github.com/vuejs/core/pull/3399
|
||||
// biome-ignore lint: disable
|
||||
export {}
|
||||
|
||||
/* prettier-ignore */
|
||||
declare module 'vue' {
|
||||
export interface GlobalComponents {
|
||||
RouterLink: typeof import('vue-router')['RouterLink']
|
||||
RouterView: typeof import('vue-router')['RouterView']
|
||||
}
|
||||
}
|
||||
7
main.js
7
main.js
|
|
@ -3,6 +3,7 @@ import App from './App'
|
|||
// #ifndef VUE3
|
||||
import Vue from 'vue'
|
||||
import './uni.promisify.adaptor'
|
||||
|
||||
Vue.config.productionTip = false
|
||||
App.mpType = 'app'
|
||||
const app = new Vue({
|
||||
|
|
@ -12,9 +13,13 @@ app.$mount()
|
|||
// #endif
|
||||
|
||||
// #ifdef VUE3
|
||||
import { createSSRApp } from 'vue'
|
||||
|
||||
import {
|
||||
createSSRApp
|
||||
} from 'vue'
|
||||
export function createApp() {
|
||||
const app = createSSRApp(App)
|
||||
|
||||
return {
|
||||
app
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,9 +53,9 @@
|
|||
"appid" : "wx683d8a8a499d7ec6",
|
||||
"setting" : {
|
||||
"urlCheck" : false,
|
||||
"minified" : true,
|
||||
"minified" : false,
|
||||
"es6" : false,
|
||||
"postcss" : true
|
||||
"postcss" : false
|
||||
},
|
||||
"usingComponents" : true
|
||||
},
|
||||
|
|
|
|||
1214
package-lock.json
generated
Normal file
1214
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
12
package.json
Normal file
12
package.json
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"dependencies": {
|
||||
"@dcloudio/uni-ui": "^1.5.7",
|
||||
"crypto-js": "^4.2.0",
|
||||
"js-md5": "^0.8.3",
|
||||
"qs": "^6.14.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"unplugin-auto-import": "^19.3.0",
|
||||
"unplugin-vue-components": "^28.7.0"
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<view class="content bg" style="background-image: url('/static/bags_bg.png');">
|
||||
<view class="content bg" style="background-image: url('@@:static/bags_bg.png');">
|
||||
|
||||
<view class="" style="width: 100%; overflow: auto;">
|
||||
|
||||
|
|
@ -8,7 +8,7 @@
|
|||
<view class="" v-for="(item,index) in dataList"
|
||||
style="width: 100%; height: 161.81rpx; background-color: #FFFBF0; border-radius: 30rpx; margin-bottom: 29.17rpx; display: flex; align-items: center; position: relative;">
|
||||
|
||||
<image :src="item.isCheck?'/static/ic_check_s.png':'/static/ic_check.png'"
|
||||
<image :src="item.isCheck?'@@:static/ic_check_s.png':'@@:static/ic_check.png'"
|
||||
@click="toggleItem(index)" style="width: 29.17rpx; height: 29.17rpx; margin-left: 20.83rpx;"
|
||||
mode=""></image>
|
||||
|
||||
|
|
@ -32,11 +32,11 @@
|
|||
|
||||
<view class=""
|
||||
style="display: flex; flex-direction: row; position: absolute; bottom: 23.61rpx; right: 23.61rpx; align-items: center;">
|
||||
<image src="/static/ic_minus.png" @click="decrease(index)"
|
||||
<image src="@@:static/ic_minus.png" @click="decrease(index)"
|
||||
style="width: 28.47rpx; height: 28.47rpx;" mode=""></image>
|
||||
<text
|
||||
style="width: 70.83rpx; font-size: 29.17rpx; color: #6E5B51; text-align: center;">{{item.num}}</text>
|
||||
<image src="/static/ic_add.png" @click="increase(index)"
|
||||
<image src="@@:static/ic_add.png" @click="increase(index)"
|
||||
style="width: 28.47rpx; height: 28.47rpx;" mode=""></image>
|
||||
</view>
|
||||
|
||||
|
|
@ -49,9 +49,9 @@
|
|||
<view class=""
|
||||
style="width: 100%; height: 114.58rpx; background-color: #FFFDF1; position: fixed; bottom: 0; display: flex; flex-direction: row-reverse; align-items: center;">
|
||||
|
||||
<view class=""
|
||||
<view class=""
|
||||
style="width: 164.58rpx; height: 68.75rpx; position: relative; margin-right: 19.44rpx; display: flex; align-items: center; justify-content: center;">
|
||||
<image src="/static/pay_bg.png" style="width: 100%; height: 100%;position: absolute;" mode=""></image>
|
||||
<image src="https://guyu-1308826010.cos.ap-shanghai.myqcloud.com/static/pay_bg.png" style="width: 100%; height: 100%;position: absolute;" mode=""></image>
|
||||
<text style="position: absolute; font-size: 20.83rpx; color: #66594E;">结算 ({{checkNum}})</text>
|
||||
</view>
|
||||
|
||||
|
|
@ -62,7 +62,7 @@
|
|||
|
||||
<view class=""
|
||||
style="display: flex; flex-direction: row; align-items: center; position: fixed; left: 46rpx;">
|
||||
<image :src="selectAll?'/static/ic_check_s.png':'/static/ic_check.png'" @click="toggleSelectAll"
|
||||
<image :src="selectAll?'@@:static/ic_check_s.png':'@@:static/ic_check.png'" @click="toggleSelectAll"
|
||||
style="width: 29.17rpx; height: 29.17rpx;" mode=""></image>
|
||||
<text style="font-size: 19.42rpx; color: #8C8574; margin-left: 13rpx; margin-bottom: 2rpx;">全选</text>
|
||||
</view>
|
||||
|
|
|
|||
|
|
@ -1,18 +1,16 @@
|
|||
<template>
|
||||
<view class="content" style="background-color: #FFFDF6;">
|
||||
|
||||
<image src="/static/bg.png" style="width: 620.83rpx; height: 100%; position: absolute;" mode=""></image>
|
||||
<image src="@@:static/bg.png" style="width: 620.83rpx; height: 100%; position: absolute;" mode=""></image>
|
||||
|
||||
|
||||
<view class="content" style="position: absolute;">
|
||||
|
||||
|
||||
<!-- 搜索 -->
|
||||
<view class="" style="width: 100%; margin-top: 96.53rpx;">
|
||||
<view class=""
|
||||
style="width: 230.56rpx; height: 71.53rpx; background-color: #FFFFFF; border: 5rpx solid #F5D677; border-radius: 50rpx; display: flex; align-items: center;">
|
||||
<image src="/static/ic_search.png" style="width: 28.47rpx; height: 28.47rpx; margin-left: 25rpx;"
|
||||
mode=""></image>
|
||||
<image src="@@:static/ic_search.png"
|
||||
style="width: 28.47rpx; height: 28.47rpx; margin-left: 25rpx;" mode=""></image>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
|
@ -20,8 +18,8 @@
|
|||
<view class=""
|
||||
style="width:100%; height: 57.64rpx; background-color: #FFFFFF; border: 5rpx solid #F5D677; border-radius: 20rpx; margin-top: 33.33rpx; display: flex; align-items: center;">
|
||||
|
||||
<image src="/static/ic_notice.png" style="width: 23.61rpx; height: 22.92rpx; margin-left: 24.31rpx;"
|
||||
mode=""></image>
|
||||
<image src="@@:static/ic_notice.png"
|
||||
style="width: 23.61rpx; height: 22.92rpx; margin-left: 24.31rpx;" mode=""></image>
|
||||
<view class="news-text">
|
||||
<uni-notice-bar scrollable single :style="{ width: `100%` }" :speed="8"
|
||||
background-color="transparent" color="#6B5E4B" text="感谢您的理解与支持"></uni-notice-bar>
|
||||
|
|
@ -35,7 +33,7 @@
|
|||
<swiper :indicator-dots="false" :autoplay="true" :interval="3000" :duration="500" :circular="true">
|
||||
<swiper-item v-for="(item, index) in swiperList" :key="index">
|
||||
<view class="" style="background-color: #F5D677; width: 100%; height: 300rpx;">
|
||||
{{item}}
|
||||
{{ item }}
|
||||
</view>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
|
|
@ -45,16 +43,16 @@
|
|||
<view class=""
|
||||
style="width: 100%; display: flex; flex-direction: row; justify-content: space-between; margin-top: 29.86rpx;">
|
||||
|
||||
<view class="" v-for="(item,index) in dataList" @click="toDetails(dataList[index].id)"
|
||||
<view class="" v-for="(item, index) in dataList" @click="toDetails(dataList[index].id)"
|
||||
style="display: flex; flex-direction: column; justify-content: center;">
|
||||
|
||||
<view class=""
|
||||
style="width: 159.72rpx; height: 159.72rpx; background-color: #FDF4D5; border-radius: 40rpx;"
|
||||
:style="{ border: `2px solid ${item.color}`}">
|
||||
:style="{ border: `2px solid ${item.color}` }">
|
||||
</view>
|
||||
|
||||
<text class="myZt-300w"
|
||||
style="text-align: center; margin-top: 13.19rpx; font-size: 22.22rpx; color: #685952; width: 159.72rpx; text-overflow: ellipsis; white-space: nowrap; overflow: hidden;">{{item.title}}</text>
|
||||
style="text-align: center; margin-top: 13.19rpx; font-size: 22.22rpx; color: #685952; width: 159.72rpx; text-overflow: ellipsis; white-space: nowrap; overflow: hidden;">{{ item.title }}</text>
|
||||
|
||||
</view>
|
||||
|
||||
|
|
@ -63,9 +61,9 @@
|
|||
|
||||
<!-- tab -->
|
||||
<view class="" style="width: 100%; display: flex; flex-direction: row; margin-top: 32.64rpx;">
|
||||
<view class="" v-for="(item,index) in tabList" @click="clickTab(index)" :style="setTabBg(index)"
|
||||
<view class="" v-for="(item, index) in tabList" @click="clickTab(index)" :style="setTabBg(index)"
|
||||
style="padding: 0 16.67rpx 6rpx 16.67rpx ; margin-right: 26.39rpx; border-radius: 50rpx;">
|
||||
<text class="myZt-500w" style=" font-size: 23.61rpx;">{{item.title}}</text>
|
||||
<text class="myZt-500w" style=" font-size: 23.61rpx;">{{ item.title }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
|
@ -73,7 +71,7 @@
|
|||
<!-- 商品列表 -->
|
||||
|
||||
<view class="grid-container">
|
||||
<view class="" v-for="(item,index) in goodsLsit"
|
||||
<view class="" v-for="(item, index) in goodsLsit"
|
||||
style="height: 490.28rpx; background-color: #FEF6D6; border: 3rpx solid #F9D051; border-radius: 40rpx;display: flex; flex-direction: column;">
|
||||
<view class=""
|
||||
style="width: 100%; height: 320.83rpx; background-color: #FFFFFF;border-radius: 40rpx 40rpx 0 0; ">
|
||||
|
|
@ -82,14 +80,13 @@
|
|||
|
||||
<text class="myZt-500w"
|
||||
style="width: 280.56rpx; margin: 15.28rpx auto; font-size: 25rpx; color: #685952;
|
||||
display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; text-overflow: ellipsis;">{{item.title}}</text>
|
||||
display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; text-overflow: ellipsis;">{{ item.title }}</text>
|
||||
|
||||
|
||||
<text style="font-size: 19.44rpx; color: #FF6A6A; margin-left: 24.31rpx;">现货发售中</text>
|
||||
|
||||
<view class="" style="display: flex; flex-direction: row; margin-left: 20.31rpx;">
|
||||
<text class="myZt-500w"
|
||||
style="font-size: 29.17rpx; color: #87644E;">¥{{item.price}}</text>
|
||||
<text class="myZt-500w" style="font-size: 29.17rpx; color: #87644E;">¥{{ item.price }}</text>
|
||||
<text style="font-size: 19.44rpx; color: #87644E; margin-top: 10rpx;"> / 包</text>
|
||||
</view>
|
||||
|
||||
|
|
@ -110,197 +107,194 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
currendIndex: 0,
|
||||
swiperList: [1, 2, 3, 4],
|
||||
dataList: [{
|
||||
id: 1,
|
||||
title: "坂本日常",
|
||||
color: "#90BB76",
|
||||
url: ""
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
title: "坂本日常",
|
||||
color: "#FDA6AA",
|
||||
url: ""
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
title: "坂本日常",
|
||||
color: "#96ABEB",
|
||||
url: ""
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
title: "坂本日常",
|
||||
color: "#F9D051",
|
||||
url: ""
|
||||
}
|
||||
],
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
currendIndex: 0,
|
||||
swiperList: [1, 2, 3, 4],
|
||||
dataList: [{
|
||||
id: 1,
|
||||
title: "坂本日常",
|
||||
color: "#90BB76",
|
||||
url: ""
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
title: "坂本日常",
|
||||
color: "#FDA6AA",
|
||||
url: ""
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
title: "坂本日常",
|
||||
color: "#96ABEB",
|
||||
url: ""
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
title: "坂本日常",
|
||||
color: "#F9D051",
|
||||
url: ""
|
||||
}
|
||||
],
|
||||
|
||||
tabList: [{
|
||||
id: 1,
|
||||
title: "全部"
|
||||
}, {
|
||||
id: 1,
|
||||
title: "吧唧"
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
title: "立牌"
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
title: "色纸"
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
title: "拍立得"
|
||||
}
|
||||
],
|
||||
goodsLsit: [{
|
||||
id: 1,
|
||||
title: "坂本日常坂本日常坂本日常坂本日常坂本日常坂本日常坂本日常坂本日常坂本日常",
|
||||
imgUrl: "",
|
||||
type: "",
|
||||
price: "20"
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
title: "坂本日常坂本日常坂本日常坂本日常",
|
||||
imgUrl: "",
|
||||
type: "",
|
||||
price: "20"
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
title: "坂本日常坂本日常坂本日常坂本日常",
|
||||
imgUrl: "",
|
||||
type: "",
|
||||
price: "20"
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
title: "坂本日常坂本日常坂本日常坂本日常",
|
||||
imgUrl: "",
|
||||
type: "",
|
||||
price: "20"
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
title: "坂本日常坂本日常坂本日常坂本日常",
|
||||
imgUrl: "",
|
||||
type: "",
|
||||
price: "20"
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
title: "坂本日常坂本日常坂本日常坂本日常",
|
||||
imgUrl: "",
|
||||
type: "",
|
||||
price: "20"
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
title: "坂本日常坂本日常坂本日常坂本日常",
|
||||
imgUrl: "",
|
||||
type: "",
|
||||
price: "20"
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
title: "坂本日常坂本日常坂本日常坂本日常",
|
||||
imgUrl: "",
|
||||
type: "",
|
||||
price: "20"
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
title: "坂本日常坂本日常坂本日常坂本日常",
|
||||
imgUrl: "",
|
||||
type: "",
|
||||
price: "20"
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
title: "坂本日常坂本日常坂本日常坂本日常",
|
||||
imgUrl: "",
|
||||
type: "",
|
||||
price: "20"
|
||||
}
|
||||
]
|
||||
tabList: [{
|
||||
id: 1,
|
||||
title: "全部"
|
||||
}, {
|
||||
id: 1,
|
||||
title: "吧唧"
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
title: "立牌"
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
title: "色纸"
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
title: "拍立得"
|
||||
}
|
||||
],
|
||||
goodsLsit: [{
|
||||
id: 1,
|
||||
title: "坂本日常坂本日常坂本日常坂本日常坂本日常坂本日常坂本日常坂本日常坂本日常",
|
||||
imgUrl: "",
|
||||
type: "",
|
||||
price: "20"
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
title: "坂本日常坂本日常坂本日常坂本日常",
|
||||
imgUrl: "",
|
||||
type: "",
|
||||
price: "20"
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
title: "坂本日常坂本日常坂本日常坂本日常",
|
||||
imgUrl: "",
|
||||
type: "",
|
||||
price: "20"
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
title: "坂本日常坂本日常坂本日常坂本日常",
|
||||
imgUrl: "",
|
||||
type: "",
|
||||
price: "20"
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
title: "坂本日常坂本日常坂本日常坂本日常",
|
||||
imgUrl: "",
|
||||
type: "",
|
||||
price: "20"
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
title: "坂本日常坂本日常坂本日常坂本日常",
|
||||
imgUrl: "",
|
||||
type: "",
|
||||
price: "20"
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
title: "坂本日常坂本日常坂本日常坂本日常",
|
||||
imgUrl: "",
|
||||
type: "",
|
||||
price: "20"
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
title: "坂本日常坂本日常坂本日常坂本日常",
|
||||
imgUrl: "",
|
||||
type: "",
|
||||
price: "20"
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
title: "坂本日常坂本日常坂本日常坂本日常",
|
||||
imgUrl: "",
|
||||
type: "",
|
||||
price: "20"
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
title: "坂本日常坂本日常坂本日常坂本日常",
|
||||
imgUrl: "",
|
||||
type: "",
|
||||
price: "20"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
clickTab(index) {
|
||||
this.currendIndex = index;
|
||||
},
|
||||
|
||||
setTabBg(index) {
|
||||
if (this.currendIndex == index) {
|
||||
return {
|
||||
backgroundColor: '#F5D677',
|
||||
border: '1rpx solid transparent'
|
||||
}
|
||||
} else {
|
||||
return {
|
||||
backgroundColor: 'transparent',
|
||||
border: '1rpx solid #9A8F79'
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
clickTab(index) {
|
||||
this.currendIndex = index;
|
||||
},
|
||||
|
||||
setTabBg(index) {
|
||||
if (this.currendIndex == index) {
|
||||
return {
|
||||
backgroundColor: '#F5D677',
|
||||
border: '1rpx solid transparent'
|
||||
}
|
||||
} else {
|
||||
return {
|
||||
backgroundColor: 'transparent',
|
||||
border: '1rpx solid #9A8F79'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
toDetails(id) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/home/product-details?id=' + id
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
toDetails(id) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/home/product-details?id=' + id
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.content {
|
||||
width: 693.06rpx;
|
||||
height: 100vh;
|
||||
margin: 0 auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
position: relative;
|
||||
align-items: center;
|
||||
.content {
|
||||
width: 693.06rpx;
|
||||
height: 100vh;
|
||||
margin: 0 auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
position: relative;
|
||||
align-items: center;
|
||||
|
||||
}
|
||||
|
||||
.news-text {
|
||||
width: 600rpx;
|
||||
height: 57.64rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-left: 18rpx;
|
||||
padding-top: 20rpx;
|
||||
|
||||
::v-deep.uni-noticebar__content-text {
|
||||
font-size: 22.22rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.news-text {
|
||||
width: 600rpx;
|
||||
height: 57.64rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-left: 18rpx;
|
||||
padding-top: 20rpx;
|
||||
|
||||
::v-deep.uni-noticebar__content-text {
|
||||
font-size: 22.22rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.grid-container {
|
||||
width: 100%;
|
||||
display: grid;
|
||||
/* 3列等宽 */
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
/* 间距 */
|
||||
gap: 34.72rpx;
|
||||
padding: 20rpx;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.grid-container {
|
||||
width: 100%;
|
||||
display: grid;
|
||||
/* 3列等宽 */
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
/* 间距 */
|
||||
gap: 34.72rpx;
|
||||
padding: 20rpx;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -1,26 +1,26 @@
|
|||
<template>
|
||||
<view class="content bg" style="background-image: url('/static/details_bg.png');">
|
||||
<view class="content bg" style="background-image: url('@@:static/details_bg.png');">
|
||||
|
||||
<view class="back" @click="toBack()">
|
||||
<image src="/static/ic_back.png" mode=""></image>
|
||||
<image src="@@:static/ic_back.png" mode=""></image>
|
||||
</view>
|
||||
|
||||
<view class="title bg" style=" background-image: url('/static/title_bg.png');">
|
||||
<view class="title bg" style=" background-image: url('@@:static/title_bg.png');">
|
||||
<text>坂本日常 吧唧</text>
|
||||
</view>
|
||||
|
||||
<view class="v_fun">
|
||||
<image src="/static/bags.png" mode=""></image>
|
||||
<image src="@@:static/bags.png" mode=""></image>
|
||||
|
||||
<image src="/static/details.png" @click="openDetailsPop()" mode="">
|
||||
<image src="@@:static/details.png" @click="openDetailsPop()" mode="">
|
||||
</image>
|
||||
|
||||
<image src="/static/share.png" mode=""></image>
|
||||
<image src="@@:static/share.png" mode=""></image>
|
||||
</view>
|
||||
|
||||
|
||||
<!-- ip背景 -->
|
||||
<view class="ipBg bg" style="background-image: url('/static/goods_bg.png');">
|
||||
<view class="ipBg bg" style="background-image: url('@@:static/goods_bg.png');">
|
||||
|
||||
<!-- 轮播图 -->
|
||||
<view class="" style="width: 100%; height: 448.61rpx;margin-top: 54.86rpx;">
|
||||
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
|
||||
<view class="tip">
|
||||
<image src="/static/ic_prompt.png" style="width: 513.89rpx; height: 51.39rpx; position: absolute;">
|
||||
<image src="@@:static/ic_prompt.png" style="width: 513.89rpx; height: 51.39rpx; position: absolute;">
|
||||
</image>
|
||||
<text style="position: absolute; font-size: 20.83rpx; color: #8C8574;">运费10元 满100包邮 3-5个工作日发货</text>
|
||||
</view>
|
||||
|
|
@ -37,24 +37,24 @@
|
|||
|
||||
<!-- 购买按钮 -->
|
||||
<view class="pay" @click="openPayPop()">
|
||||
<image src="/static/ic_pay.png" mode=""></image>
|
||||
<image src="@@:static/ic_pay.png" mode=""></image>
|
||||
<view class="price">
|
||||
<text>¥20</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<image class="join" src="/static/ic_join.png" mode=""></image>
|
||||
<image class="join" src="@@:static/ic_join.png" mode=""></image>
|
||||
|
||||
</view>
|
||||
|
||||
<!-- 详情弹窗 -->
|
||||
<uni-popup ref="detailsPop" type="bottom" :safe-area='false'>
|
||||
<view class="detailsPop bg" style="background-image: url('/static/specifics_bg.png');">
|
||||
<view class="detailsPop bg" style="background-image: url('@@:static/specifics_bg.png');">
|
||||
<view class="popTitle">
|
||||
<view style="width: 30rpx;"></view>
|
||||
<text style="font-size: 31.25rpx; color: #695C4E;">商品详情</text>
|
||||
<view class="popClose" style="" @click="closeDetailsPop()">
|
||||
<image src="/static/ic_close.png" style="" mode=""></image>
|
||||
<image src="@@:static/ic_close.png" style="" mode=""></image>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
|
@ -69,13 +69,13 @@
|
|||
|
||||
<!-- 购买弹窗 -->
|
||||
<uni-popup ref="payPop" type="bottom" :safe-area='false'>
|
||||
<view class="payPop bg" style=" background-image: url('/static/pay_pop_bg.png');">
|
||||
<view class="payPop bg" style=" background-image: url('@@:static/pay_pop_bg.png');">
|
||||
|
||||
<view class="popTitle">
|
||||
<view style="width: 30rpx;"></view>
|
||||
<text style="font-size: 22.22rpx; color: #8C8574;">本商品不可退换 未成年人请谨慎购买</text>
|
||||
<view class="popClose" @click="closePayPop()()">
|
||||
<image src="/static/ic_close.png" mode=""></image>
|
||||
<image src="@@:static/ic_close.png" mode=""></image>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
|
@ -83,11 +83,11 @@
|
|||
<!-- 地址 -->
|
||||
<view class="payPopAddress">
|
||||
|
||||
<image class="image1" src="/static/ic_address.png" mode=""></image>
|
||||
<image class="image1" src="@@:static/ic_address.png" mode=""></image>
|
||||
|
||||
<text>某某 河南省河南省河南省河南省</text>
|
||||
|
||||
<image class="image2" src="/static/ic_right_arrow.png" mode=""></image>
|
||||
<image class="image2" src="@@:static/ic_right_arrow.png" mode=""></image>
|
||||
|
||||
</view>
|
||||
|
||||
|
|
@ -108,11 +108,11 @@
|
|||
|
||||
<!-- 加减数量 -->
|
||||
<view class="addSub">
|
||||
<image src="/static/ic_minus.png" @click="decrease(index)"
|
||||
<image src="@@:static/ic_minus.png" @click="decrease(index)"
|
||||
style="width: 28.47rpx; height: 28.47rpx;" mode=""></image>
|
||||
<text
|
||||
style="width: 70.83rpx; font-size: 29.17rpx; color: #6E5B51; text-align: center;">{{goodsNum}}</text>
|
||||
<image src="/static/ic_add.png" @click="increase(index)"
|
||||
<image src="@@:static/ic_add.png" @click="increase(index)"
|
||||
style="width: 28.47rpx; height: 28.47rpx;" mode=""></image>
|
||||
</view>
|
||||
|
||||
|
|
@ -132,11 +132,11 @@
|
|||
</view>
|
||||
|
||||
<view class="payAgreement">
|
||||
<image src="/static/ic_check.png" style="width: 23.61rpx; height: 23.61rpx;" mode=""></image>
|
||||
<image src="@@:static/ic_check.png" style="width: 23.61rpx; height: 23.61rpx;" mode=""></image>
|
||||
<text style="color: #8C8574; margin-left: 10rpx;">同意 <text style="color: #FCAD6F;"> 《用户协议》</text>
|
||||
</text>
|
||||
</view>
|
||||
<image class="conPay" src="/static/confirm_pay.png" mode=""></image>
|
||||
<image class="conPay" src="@@:static/confirm_pay.png" mode=""></image>
|
||||
</view>
|
||||
</uni-popup>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
<template>
|
||||
<view class="content bg" style="background-image: url('/static/bags_bg.png');">
|
||||
<view class="content bg" style="background-image: url('@@:static/bags_bg.png');">
|
||||
|
||||
<view class="title">
|
||||
<view class="back" @click="toBack()">
|
||||
<image src="/static/ic_back.png" mode=""></image>
|
||||
<image src="@@:static/ic_back.png" mode=""></image>
|
||||
</view>
|
||||
<text>我的优惠券</text>
|
||||
<view class="back"></view>
|
||||
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
<text class="item-time">{{item.time}}</text>
|
||||
|
||||
<image class="item-type" :src="item.type==0?'/static/coupon_0.png':'/static/coupon_1.png'" mode="">
|
||||
<image class="item-type" :src="item.type==0?'@@:static/coupon_0.png':'@@:static/coupon_1.png'" mode="">
|
||||
</image>
|
||||
|
||||
</view>
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
<template>
|
||||
<view class="content bg" style="background-image: url('/static/bags_bg.png');">
|
||||
<view class="content bg" style="background-image: url('@@:static/bags_bg.png');">
|
||||
|
||||
<view class="title">
|
||||
<view class="back" @click="toBack()">
|
||||
<image src="/static/ic_back.png" mode=""></image>
|
||||
<image src="@@:static/ic_back.png" mode=""></image>
|
||||
</view>
|
||||
<text>物流详情</text>
|
||||
<view class="back"></view>
|
||||
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
<view class="row" style="align-items: center; position: absolute; left: 182.64rpx; bottom: 34.03rpx;">
|
||||
<text style="font-size: 19.42rpx; color: #8C8574;">快递单号:9569469491691981</text>
|
||||
<image src="/static/ic_copy.png" @click="copyData" style="width: 20.83rpx; height: 20.83rpx; margin-left: 10rpx;" mode="">
|
||||
<image src="@@:static/ic_copy.png" @click="copyData" style="width: 20.83rpx; height: 20.83rpx; margin-left: 10rpx;" mode="">
|
||||
</image>
|
||||
</view>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<view class="content" style="background-image: url('/static/bags_bg.png');">
|
||||
<view class="content" style="background-image: url('@@:static/bags_bg.png');">
|
||||
|
||||
|
||||
<view class="" @click="toInfo()"
|
||||
|
|
@ -12,7 +12,7 @@
|
|||
<view class=""
|
||||
style="display: flex; flex-direction: row; position: absolute; align-items: center; left: 186.81rpx; top: 35.42rpx;">
|
||||
<text style="font-size: 29.17rpx; color: #6E5B51;">坂本日常</text>
|
||||
<image src="/static/ic_modify.png" style="width: 22.92rpx; height: 22.92rpx; margin-left: 13.16rpx;"
|
||||
<image src="@@:static/ic_modify.png" style="width: 22.92rpx; height: 22.92rpx; margin-left: 13.16rpx;"
|
||||
mode=""></image>
|
||||
</view>
|
||||
|
||||
|
|
@ -26,19 +26,19 @@
|
|||
<view style="width: 0.69rpx; height: 98.61rpx; "></view>
|
||||
|
||||
<!-- 优惠券 -->
|
||||
<image @click="toCoupon()" src="/static/ic_coupon.png" style="width: 100.69rpx; height: 98.61rpx;" mode="">
|
||||
<image @click="toCoupon()" src="@@:static/ic_coupon.png" style="width: 100.69rpx; height: 98.61rpx;" mode="">
|
||||
</image>
|
||||
|
||||
<view style="width: 0.69rpx; height: 98.61rpx; background-color: #6E5B51;"></view>
|
||||
|
||||
<!-- 订单管理 -->
|
||||
<image @click="toOrder()" src="/static/ic_order.png" style="width: 100.69rpx; height: 98.61rpx;" mode="">
|
||||
<image @click="toOrder()" src="@@:static/ic_order.png" style="width: 100.69rpx; height: 98.61rpx;" mode="">
|
||||
</image>
|
||||
|
||||
<view style="width: 0.69rpx; height: 98.61rpx; background-color: #6E5B51;"></view>
|
||||
|
||||
<!-- 联系客服 -->
|
||||
<image src="/static/ic_kf.png" style="width: 100.69rpx; height: 98.61rpx;" mode=""></image>
|
||||
<image src="@@:static/ic_kf.png" style="width: 100.69rpx; height: 98.61rpx;" mode=""></image>
|
||||
<view style="width: 0.69rpx; height: 98.61rpx; "></view>
|
||||
|
||||
</view>
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
<template>
|
||||
<view class="content bg" style="background-image: url('/static/bags_bg.png');">
|
||||
<view class="content bg" style="background-image: url('@@:static/bags_bg.png');">
|
||||
|
||||
<view class="title">
|
||||
<view class="back" @click="toBack()">
|
||||
<image src="/static/ic_back.png" mode=""></image>
|
||||
<image src="@@:static/ic_back.png" mode=""></image>
|
||||
</view>
|
||||
<text>订单管理</text>
|
||||
<view class="back"></view>
|
||||
|
|
@ -37,7 +37,7 @@
|
|||
|
||||
|
||||
<view class="row" style="align-items: center; position: absolute; left: 30.56rpx; top: 227.08rpx;">
|
||||
<image src="/static/ic_address.png" style="width: 19.44rpx; height: 22.92rpx;" mode=""></image>
|
||||
<image src="@@:static/ic_address.png" style="width: 19.44rpx; height: 22.92rpx;" mode=""></image>
|
||||
<text style="font-size: 23.58rpx; color: #6E5B51; margin-left: 10rpx;">{{item.address}}</text>
|
||||
</view>
|
||||
|
||||
|
|
@ -46,9 +46,9 @@
|
|||
|
||||
|
||||
<view class="row" style="position: absolute; right: 24.31rpx; bottom: 31.94rpx;">
|
||||
<image src="/static/ic_logistics.png" style="width: 143.75rpx; height: 59.72rpx;"
|
||||
<image src="@@:static/ic_logistics.png" style="width: 143.75rpx; height: 59.72rpx;"
|
||||
@click="toDetails(index)" mode=""></image>
|
||||
<image src="/static/confirm_receipt.png"
|
||||
<image src="@@:static/confirm_receipt.png"
|
||||
style="width: 143.75rpx; height: 59.72rpx; margin-left: 25.69rpx;" mode=""></image>
|
||||
</view>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
<template>
|
||||
<view class="content bg" style="background-image: url('/static/bags_bg.png');">
|
||||
<view class="content bg" style="background-image: url('@@:static/bags_bg.png');">
|
||||
|
||||
|
||||
<view class="title">
|
||||
<view class="back" @click="toBack()">
|
||||
<image src="/static/ic_back.png" mode=""></image>
|
||||
<image src="@@:static/ic_back.png" mode=""></image>
|
||||
</view>
|
||||
|
||||
<text>个人信息</text>
|
||||
|
|
@ -40,7 +40,7 @@
|
|||
|
||||
</view>
|
||||
|
||||
<image class="save" src="/static/ic_save.png" mode="">
|
||||
<image class="save" src="@@:static/ic_save.png" mode="">
|
||||
</image>
|
||||
|
||||
|
||||
|
|
|
|||
2
uni.scss
2
uni.scss
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
全局css
|
||||
*/
|
||||
$baseurl: "https://guyu-1308826010.cos.ap-shanghai.myqcloud.com/static/";
|
||||
$baseurl: "@@:static/";
|
||||
|
||||
@font-face {
|
||||
font-family: "JiangChengYuanTi-300W";
|
||||
|
|
|
|||
101
vite.config.js
Normal file
101
vite.config.js
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
import {
|
||||
defineConfig
|
||||
} from 'vite';
|
||||
import uni from "@dcloudio/vite-plugin-uni";
|
||||
import AutoImport from 'unplugin-auto-import/vite';
|
||||
import Components from 'unplugin-vue-components/vite';
|
||||
|
||||
export default defineConfig({
|
||||
build: {
|
||||
minify: 'terser',
|
||||
// assetsInlineLimit: 0, // 禁止将图片转成 import
|
||||
terserOptions: {
|
||||
compress: {
|
||||
drop_console: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
plugins: [
|
||||
uni(),
|
||||
{
|
||||
name: 'transform-assets',
|
||||
enforce: 'pre', // 在 Vue 插件之前执行
|
||||
transform(code, id) {
|
||||
|
||||
if (/\.(vue|js|ts|css|scss|json)$/.test(id)) {
|
||||
let count = 0
|
||||
const replacedCode = code.replace(
|
||||
/@@:([^\s"'()<>]+?\.(png|jpe?g|gif|svg|webp))/g,
|
||||
(match, path) => {
|
||||
count++
|
||||
return `https://guyu-1308826010.cos.ap-shanghai.myqcloud.com/${path}`
|
||||
}
|
||||
);
|
||||
// code.replace(
|
||||
// /@\/?([^\s"'()]+)/g,
|
||||
// (match) => {
|
||||
// count++
|
||||
// return 'https://guyu-1308826010.cos.ap-shanghai.myqcloud.com/' + match
|
||||
// .replace(/^http:\/\/@\/?/, '')
|
||||
// }
|
||||
// )
|
||||
if (count > 0) {
|
||||
console.log(id, `本次替换了 ${count} 个图片地址`)
|
||||
}
|
||||
// console.log(id, fcode)
|
||||
return {
|
||||
code: replacedCode,
|
||||
map: null
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
// 自动导入 Vue 相关 API(如 ref, reactive)
|
||||
AutoImport({
|
||||
imports: ['vue',
|
||||
{
|
||||
'@dcloudio/uni-app': [
|
||||
'onLoad', // 页面加载时触发
|
||||
'onShow', // 页面显示时触发
|
||||
'onHide', // 页面隐藏时触发
|
||||
'onUnload', // 页面卸载时触发
|
||||
],
|
||||
},
|
||||
{
|
||||
'@/common/utils': [
|
||||
'showToast', // 明确列出方法名(推荐)
|
||||
'sleep',
|
||||
],
|
||||
}
|
||||
// ,
|
||||
// {
|
||||
// '@/common/yds': [
|
||||
// ['yds'], // 从 '@/common/index' 导入 yds 对象
|
||||
// ],
|
||||
// }
|
||||
],
|
||||
}),
|
||||
// 自动导入组件
|
||||
Components({
|
||||
dirs: [
|
||||
// 'components/guyu-container',
|
||||
// 'components/uni-nav-bar',
|
||||
// 'components/uni-popup',
|
||||
// 'components/uni-transition'
|
||||
], // 指定组件目录
|
||||
extensions: ['vue'],
|
||||
dts: true, // 生成类型声明文件(可选)
|
||||
// resolvers: [
|
||||
// (name) => {
|
||||
// if (name === 'uni-popup') { // 匹配 kebab-case 名称
|
||||
// return {
|
||||
// importName: 'uni-popup', // 组件文件实际导出的名称
|
||||
// path: '@/components/uni-popup/components/uni-popup/uni-popup.vue', // 文件路径
|
||||
// kebabCase: true
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// ]
|
||||
}),
|
||||
]
|
||||
});
|
||||
Loading…
Reference in New Issue
Block a user