diff --git a/pages.json b/pages.json index 8396550..890800f 100644 --- a/pages.json +++ b/pages.json @@ -9,7 +9,8 @@ { "path": "pages/user/user", "style": { - "navigationBarTitleText": "大美非遗" + "navigationBarTitleText": "我的", + "navigationStyle": "custom" } } ], @@ -22,6 +23,24 @@ "navigationBarTitleText": "uni-app" } }, + { + "path" : "user/privacy", + "style" : { + "navigationBarTitleText" : "详情" + } + }, + { + "path" : "user/privacyInfo", + "style" : { + "navigationBarTitleText" : "详情" + } + }, + { + "path" : "order/trades", + "style" : { + "navigationBarTitleText" : "全部订单" + } + }, { "path": "techan/index", "style": { @@ -44,8 +63,8 @@ ] }], "tabBar": { - "color": "#999999", - "selectedColor": "#333333", + "color": "#333333", + "selectedColor": "#6CA5AA", "borderStyle": "black", "backgroundColor": "#ffffff", "fontSize": "24rpx", diff --git a/pages/index/index.vue b/pages/index/index.vue index 579d4cb..9fe3e7b 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -1,6 +1,81 @@ @@ -8,14 +83,133 @@ export default { data() { return { - + topBanner: [ + { + head_img: 'https://static.ticket.sz-trip.com/uploads/20230920/7cdb05709d09cc2c86ea5671bd657c85.jpg' + }, + { + head_img: 'https://changshu.js-dyyj.com/uploads/20250418/8a7631a1955ca05e619c0a25ad5ac1d1.jpg' + } + ], + menuList: [ + { + path: '' + }, + { + path: '' + }, + { + path: '' + }, + { + path: '' + }, + { + path: '' + }, + { + path: '' + } + ], + handwrittenList: [ + {head_img: 'https://static.ticket.sz-trip.com/uploads/20230920/7cdb05709d09cc2c86ea5671bd657c85.jpg'}, + {head_img: 'https://static.ticket.sz-trip.com/uploads/20230920/7cdb05709d09cc2c86ea5671bd657c85.jpg'}, + {head_img: 'https://static.ticket.sz-trip.com/uploads/20230920/7cdb05709d09cc2c86ea5671bd657c85.jpg'}, + {head_img: 'https://static.ticket.sz-trip.com/uploads/20230920/7cdb05709d09cc2c86ea5671bd657c85.jpg'}, + ], + hotType: [ + { + title: '好物推荐', + id: '41' + }, + { + title: '猜你喜欢', + id: '41' + } + ], + hotIndex: 0, + hotList: [], + isLoading: false, + limit: 4 } }, onLoad() { + }, + onReady() { + // 获取经纬度 + if(!uni.getStorageSync('location')) { + this.getLocation() + } + + this.changeType(0) + }, + onReachBottom() { + setTimeout(() => { + if (!this.isLoading) this.getHotList(); + }, 1000); }, methods: { - + // 瀑布流 + getColumnItems(columnIndex) { + const columnItems = []; + this.hotList.forEach((item, index) => { + switch (this.hotIndex) { + case 1: + item.src = this.showImg(item.image); + break; + default: + item.src = this.showImg(item.image); + } + + if (index % 2 === columnIndex) { + columnItems.push(item); + } + }); + return columnItems; + }, + // 更改热门推荐类型 + changeType(index) { + this.hotIndex = index + this.isLoading = false + this.hotList = [] + this.getHotList() + }, + getHotList() { + if(this.typeIndex == 1) { + this.Post({ + type_id: this.hotType[this.hotIndex].id, + offset: this.hotList.length, + limit: this.limit + },'/api/Article/getArticleByType').then(res => { + if(res) { + if(res.data.length < this.limit) this.isLoading = true + this.hotList = this.hotList.concat(res.data) + } + }) + }else { + this.Post({ + type_id: this.hotType[this.hotIndex].id, + offset: this.hotList.length, + limit: this.limit + },'/api/Article/getArticleByType').then(res => { + if(res) { + if(res.data.length < this.limit) this.isLoading = true + this.hotList = this.hotList.concat(res.data) + } + }) + } + }, + gotoHotDetail(item) { + if(this.typeIndex == 1) { + // 视频 + uni.navigateTo({ + url: '/subPackages/video/video?item=' + encodeURIComponent(JSON.stringify(item)) + }) + }else { + + } + } } } @@ -26,4 +220,219 @@ background: #F9F0EA; padding: 21rpx 0 50rpx; } + + .top-box { + width: 684rpx; + height: 451rpx; + border-radius: 30rpx; + overflow: hidden; + position: relative; + margin: auto; + + .top-banner { + width: 100%; + height: 100%; + } + + .search-box { + width: 632rpx; + height: 40rpx; + background: #FFFFFF; + border-radius: 20rpx; + position: absolute; + z-index: 1000; + top: 31rpx; + left: 26rpx; + display: flex; + align-items: center; + font-weight: 500; + font-size: 24rpx; + color: #7B7C7D; + padding-left: 21rpx; + + image { + width: 29rpx; + height: 28rpx; + } + + span { + padding: 0 15rpx; + } + } + } + + .menu-box { + margin: 54rpx 33rpx 0; + + .menu-left { + flex-wrap: wrap; + + &>view { + width: 33%; + display: flex; + flex-direction: column; + align-items: center; + } + &>view:nth-child(n+4) { + margin-top: 36rpx; + } + + .topImg { + height: 108rpx; + } + + .titleImg { + height: 22rpx; + margin-top: 8rpx; + } + } + + .menu-right { + width: 254rpx; + height: 323rpx; + border-radius: 20rpx; + } + } + + .title-box { + margin: 60rpx 44rpx 21rpx 50rpx; + align-items: flex-end; + + &>image { + width: 350rpx; + height: 32rpx; + } + &>image:last-child { + width: 59rpx; + height: 20rpx; + } + } + + .handwritten-box { + margin: 0 46rpx; + flex-wrap: wrap; + + image { + width: 322rpx; + height: 181rpx; + border-radius: 10rpx; + } + &>image:nth-child(n+3) { + margin-top: 13rpx; + } + } + + .time-box { + background-size: 100% 100%; + width: 657rpx; + height: 370rpx; + border-radius: 30rpx; + margin: 23rpx auto 0; + position: relative; + + .play { + position: absolute; + top: 0; + bottom: 0; + left: 0; + right: 0; + margin: auto; + width: 90rpx; + height: 90rpx; + } + } + + .hot-type { + height: 122rpx; + font-weight: bold; + font-size: 32rpx; + color: #B5B5B6; + + &>view { + position: relative; + } + &>view::after { + content: ""; + position: absolute; + left: 0; + right: 0; + bottom: -10rpx; + background-color: #B5B5B6; + margin: 0 auto; + width: 32rpx; + height: 4rpx; + } + + .hot-active { + color: #000000; + } + .hot-active::after { + background-color: #000000; + } + } + + .hot-box { + margin: 0 48rpx; + display: flex; + justify-content: space-between; + + .hot-column { + width: 319rpx; + display: flex; + flex-direction: column; + } + + .hot-item { + width: 319rpx; + background: #FFFFFF; + border-radius: 20rpx; + overflow: hidden; + margin-bottom: 13rpx; + + .image-container { + position: relative; + + .hot-img { + width: 319rpx; + } + + .play-img { + width: 66.67rpx; + height: 66.67rpx; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + } + } + + .hot-content { + padding: 15rpx; + + .title { + font-weight: bold; + font-size: 26rpx; + color: #000000; + } + + .subtitle { + margin-top: 20rpx; + font-weight: 400; + font-size: 24rpx; + color: #000000; + display: flex; + align-items: center; + + image { + width: 48rpx; + height: 48rpx; + border-radius: 50%; + border: 1rpx solid #000000; + display: block; + margin-right: 15rpx; + } + } + } + } + } diff --git a/pages/user/user.vue b/pages/user/user.vue index 02409e3..7444496 100644 --- a/pages/user/user.vue +++ b/pages/user/user.vue @@ -1,8 +1,657 @@ - \ No newline at end of file diff --git a/static/images/home.png b/static/images/home.png index 9d13426..adfa5be 100644 Binary files a/static/images/home.png and b/static/images/home.png differ diff --git a/static/images/mine.png b/static/images/mine.png index 67970d8..386baa3 100644 Binary files a/static/images/mine.png and b/static/images/mine.png differ diff --git a/static/images/selectHome.png b/static/images/selectHome.png index 2359413..5800170 100644 Binary files a/static/images/selectHome.png and b/static/images/selectHome.png differ diff --git a/static/images/selectMine.png b/static/images/selectMine.png index 16e1d34..69b7f19 100644 Binary files a/static/images/selectMine.png and b/static/images/selectMine.png differ diff --git a/static/js/request.js b/static/js/request.js index 28d247f..3c2234e 100644 --- a/static/js/request.js +++ b/static/js/request.js @@ -1,58 +1,77 @@ -import Vue from 'vue' -import store from '@/store' +import Vue from 'vue'; +import store from '@/store'; -let NEWAPIURL = 'https://tlgz.sz-trip.com' -Vue.prototype.NEWAPIURL = NEWAPIURL +// 定义 API URL +const DEV_API_URL = 'https://tlgz.sz-trip.com'; +const PROD_API_URL = 'https://tlgz.sz-trip.com'; +const NEWAPIURL = process.env.NODE_ENV === 'development' ? DEV_API_URL : PROD_API_URL; -Vue.prototype.Post = (params, apiurl) => { - if (uni.getStorageSync('userInfo') && JSON.parse(uni.getStorageSync('userInfo')).token) params.token = JSON.parse(uni.getStorageSync('userInfo')).token - else if (store.state.user.userInfo.token) params.token = store.state.user.userInfo.token - params.token = "aa3940ea-57f5-412e-9803-4035d5115994" - return new Promise((resolve, reject) => { - uni.showLoading({ - title: '加载中' - }) - uni.request({ - method: params.method || 'GET', - url: NEWAPIURL + apiurl, - data: params || {}, - header: params.header || { - 'content-type': 'application/json', - 'token': params.token || '' - }, - success: res => { - uni.hideLoading() - if (res.data.code === 1) { - resolve(res.data) - } else { - setTimeout(() => { - uni.showToast({ - title: res.data.msg, - icon: 'none' - }) - reject(null) - }, 0) - if (res.data.code === 401) { - store.commit('changeLoginPath') - } - } - }, - fail: err => { - console.log('err', err) - uni.hideLoading() - setTimeout(() => { - uni.showToast({ - title: err.msg || err.data.msg, - icon: 'none' - }) - }, 0) - if (err.data.code === 401) { - store.commit('changeLoginPath') - } - reject(err) - } - }) - }) -} +// 获取token +const getToken = () => { + const userInfoFromStorage = uni.getStorageSync('userInfo'); + if (userInfoFromStorage) { + const userInfo = JSON.parse(userInfoFromStorage); + if (userInfo.token) { + return userInfo.token; + } + } + return store.state.user.userInfo.token; +}; -export default NEWAPIURL +// 定义错误处理函数 +const handleError = (res, reject) => { + setTimeout(() => { + uni.showToast({ + title: res.data?.msg || res.msg, + icon: 'none' + }); + reject(res); + }, 0); + if (res.data?.code === 401) { + store.commit('changeLoginPath'); + } +}; + +// 挂载到 Vue 原型上 +Vue.prototype.NEWAPIURL = NEWAPIURL; +// #ifdef H5 +Vue.prototype.NEWAPIURL = '/api'; +// #endif + +Vue.prototype.Post = (params = {}, apiurl) => { + const token = getToken() || '92f610cd-381e-4135-ac27-fc5671af8495'; + if (token) { + params.token = token; + } + return new Promise((resolve, reject) => { + uni.showLoading({ + title: '加载中' + }); + uni.request({ + method: params.method || 'GET', + url: Vue.prototype.NEWAPIURL + apiurl, + data: params, + header: { + 'content-type': 'application/json', + 'token': token || '' + }, + success: (res) => { + console.log('success', res.data); + uni.hideLoading() + if (res.data.code === 200 || res.data.code === 1) { + resolve(res.data); + } else { + handleError(res, reject); + } + }, + fail: (err) => { + console.log('err', err); + uni.hideLoading() + handleError(err, reject); + } + }); + }); +}; + +export default NEWAPIURL; + \ No newline at end of file diff --git a/subPackages/order/trades.vue b/subPackages/order/trades.vue new file mode 100644 index 0000000..81f31e4 --- /dev/null +++ b/subPackages/order/trades.vue @@ -0,0 +1,680 @@ + + + + + \ No newline at end of file diff --git a/subPackages/user/privacy.vue b/subPackages/user/privacy.vue new file mode 100644 index 0000000..40eec99 --- /dev/null +++ b/subPackages/user/privacy.vue @@ -0,0 +1,58 @@ + + + + \ No newline at end of file diff --git a/subPackages/user/privacyInfo.vue b/subPackages/user/privacyInfo.vue new file mode 100644 index 0000000..84bcba7 --- /dev/null +++ b/subPackages/user/privacyInfo.vue @@ -0,0 +1,30 @@ + + + + +