Commit edf95011 by Hantao

feat(coupon): 新增优惠券页面及集成uview-plus组件库

- 添加优惠券页面,包含满减券、折扣券、服务券三种类型
- 集成uview-plus组件库,配置easycom自动导入
- 在侧边栏添加优惠券页面入口
- 添加优惠券相关静态资源图片
- 更新uni.scss和App.vue以支持uview-plus主题
- 添加dayjs和clipboard依赖
parent 5f8720de
...@@ -48,6 +48,9 @@ ...@@ -48,6 +48,9 @@
"@dcloudio/uni-mp-toutiao": "3.0.0-3090620231104001", "@dcloudio/uni-mp-toutiao": "3.0.0-3090620231104001",
"@dcloudio/uni-mp-weixin": "3.0.0-3090620231104001", "@dcloudio/uni-mp-weixin": "3.0.0-3090620231104001",
"@dcloudio/uni-quickapp-webview": "3.0.0-3090620231104001", "@dcloudio/uni-quickapp-webview": "3.0.0-3090620231104001",
"clipboard": "^2.0.11",
"dayjs": "^1.11.19",
"uview-plus": "^3.7.0",
"vue": "^3.2.45", "vue": "^3.2.45",
"vue-i18n": "^9.1.9" "vue-i18n": "^9.1.9"
}, },
...@@ -57,7 +60,7 @@ ...@@ -57,7 +60,7 @@
"@dcloudio/uni-cli-shared": "3.0.0-3090620231104001", "@dcloudio/uni-cli-shared": "3.0.0-3090620231104001",
"@dcloudio/uni-stacktracey": "3.0.0-3090620231104001", "@dcloudio/uni-stacktracey": "3.0.0-3090620231104001",
"@dcloudio/vite-plugin-uni": "3.0.0-3090620231104001", "@dcloudio/vite-plugin-uni": "3.0.0-3090620231104001",
"vite": "^4.0.3", "sass": "^1.77.8",
"sass": "^1.77.8" "vite": "^4.0.3"
} }
} }
<script> <script>
export default { export default {
onLaunch: function() { onLaunch: function() {
uni.hideTabBar()
console.log('App Launch') console.log('App Launch')
}, },
onShow: function() { onShow: function() {
...@@ -13,6 +12,7 @@ ...@@ -13,6 +12,7 @@
} }
</script> </script>
<style> <style lang="scss">
/*每个页面公共css */ /* 注意要写在第一行,同时给style标签加入lang="scss"属性 */
@import "uview-plus/index.scss";
</style> </style>
import App from './App' import App from './App'
import uviewPlus from 'uview-plus'
// #ifndef VUE3 // #ifndef VUE3
import Vue from 'vue' import Vue from 'vue'
import './uni.promisify.adaptor' import './uni.promisify.adaptor'
...@@ -15,6 +15,7 @@ app.$mount() ...@@ -15,6 +15,7 @@ app.$mount()
import { createSSRApp } from 'vue' import { createSSRApp } from 'vue'
export function createApp() { export function createApp() {
const app = createSSRApp(App) const app = createSSRApp(App)
app.use(uviewPlus)
return { return {
app app
} }
......
{ {
"easycom": {
"autoscan": true,
// 注意一定要放在custom里,否则无效,https://ask.dcloud.net.cn/question/131175
"custom": {
"^u--(.*)": "uview-plus/components/u-$1/u-$1.vue",
"^up-(.*)": "uview-plus/components/u-$1/u-$1.vue",
"^u-([^-].*)": "uview-plus/components/u-$1/u-$1.vue"
}
},
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages "pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
{ {
"path": "pages/index/index", "path": "pages/index/index",
...@@ -19,6 +28,12 @@ ...@@ -19,6 +28,12 @@
} }
}, },
{ {
"path": "pages/coupon/index",
"style": {
"navigationStyle": "custom"
}
},
{
"path": "pages/second/index", "path": "pages/second/index",
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom"
......
...@@ -28,7 +28,7 @@ const badges = computed(() => [ ...@@ -28,7 +28,7 @@ const badges = computed(() => [
{ id: 5, title: '水质专家', sub: '完成全部关卡', iconKey: 'badge5', unlocked: badgeImgs.value >= 5 } { id: 5, title: '水质专家', sub: '完成全部关卡', iconKey: 'badge5', unlocked: badgeImgs.value >= 5 }
]); ]);
const badgeImgs = ref(1); const badgeImgs = ref(5);
const unlockedCount = computed(() => badgeImgs.value); const unlockedCount = computed(() => badgeImgs.value);
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
import { ref } from 'vue'; import { ref } from 'vue';
// 图片路径 // 图片路径
const ASSETS = { const ASSETS = Object.freeze ({
bg: '/static/start/bg.webp', bg: '/static/start/bg.webp',
title: '/static/start/title.webp', title: '/static/start/title.webp',
startBtn: '/static/start/start.webp', startBtn: '/static/start/start.webp',
...@@ -23,7 +23,7 @@ const ASSETS = { ...@@ -23,7 +23,7 @@ const ASSETS = {
badge4: '/static/start/badge4.webp', badge4: '/static/start/badge4.webp',
badge5: '/static/start/badge5.webp', badge5: '/static/start/badge5.webp',
finishBtn: '/static/start/finishBtn.webp', finishBtn: '/static/start/finishBtn.webp',
}; });
const progressImgs = ref(5); const progressImgs = ref(5);
...@@ -82,6 +82,12 @@ const navToBadgePage = () => { ...@@ -82,6 +82,12 @@ const navToBadgePage = () => {
}); });
}; };
const navToCouponPage = () => {
uni.navigateTo({
url: '/pages/coupon/index'
});
};
const toggleSidebar = () => { const toggleSidebar = () => {
isSidebarExpanded.value = !isSidebarExpanded.value; isSidebarExpanded.value = !isSidebarExpanded.value;
}; };
...@@ -141,8 +147,8 @@ const closeSidebar = () => { ...@@ -141,8 +147,8 @@ const closeSidebar = () => {
<!-- 侧边栏 --> <!-- 侧边栏 -->
<view class="sidebar-container" :class="{ expanded: isSidebarExpanded }"> <view class="sidebar-container" :class="{ expanded: isSidebarExpanded }">
<view v-if="isSidebarExpanded" class="sidebar-custom-content"> <view v-if="isSidebarExpanded" class="sidebar-custom-content">
<view class="badge-nav-btn" @click.stop="navToBadgePage"> <view class="badge-nav-btn" @click.stop="navToBadgePage"></view>
</view> <view class="badge-nav-btn" @click.stop="navToCouponPage"></view>
</view> </view>
<view class="sidebar-wrapper" @click.stop="toggleSidebar"> <view class="sidebar-wrapper" @click.stop="toggleSidebar">
<image <image
......
...@@ -6,6 +6,9 @@ ...@@ -6,6 +6,9 @@
* *
*/ */
/* uview-plus 主题变量 */
@import 'uview-plus/theme.scss';
/** /**
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能 * 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
* *
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment