diff --git a/App.vue b/App.vue
index 06bc6d5..14cb274 100644
--- a/App.vue
+++ b/App.vue
@@ -1,15 +1,79 @@
-
\ No newline at end of file
diff --git a/pages/index/components/advertisement.vue b/pages/index/components/advertisement.vue
index 5210af0..0a7269a 100644
--- a/pages/index/components/advertisement.vue
+++ b/pages/index/components/advertisement.vue
@@ -32,7 +32,10 @@
\ No newline at end of file
diff --git a/pages/index/coupons/index.vue b/pages/index/coupons/index.vue
new file mode 100644
index 0000000..3c31449
--- /dev/null
+++ b/pages/index/coupons/index.vue
@@ -0,0 +1,655 @@
+
+
+
+
+
+ 可使用红包
+ {{viewlist.totalnumber}}张
+
+
+
+
+ ¥
+ {{item.couponsAmount || 0}}
+
+
+ 优惠券(元)
+
+
+
+
+ 无门槛使用
+
+
+ 通用红包券
+
+
+ 有效期至:{{$u.timeFormat(item.endTime, 'yyyy/mm/dd') || '0'}}
+
+
+
+ {{item.status == 0 ? '去使用':'无法使用'}}
+
+
+ {{item.status == 0 ? '兑换积分':'已过期'}}
+
+
+
+
+
+
+ 查看更多
+
+
+
+
+
+ 可购买红包
+ (根据您的订单金额推荐更适合您的优惠力度)
+
+
+
+
+ 购买省钱包,本单立减
+
+
+
+ {{item.name}}
+
+
+
+
+
+
+ 通用红包
+
+
+
+ ¥
+
+
+ {{item1.couponsAmount}}
+
+
+ 无门槛
+
+
+
+
+ 有效期:{{$u.timeFormat(item1.updateTime, 'yyyy/mm/dd') || '0'}}
+
+
+
+
+
+
+
+ ¥{{item1.couponsPrice}}/张
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/index/drinks.vue b/pages/index/drinks.vue
new file mode 100644
index 0000000..80a8b20
--- /dev/null
+++ b/pages/index/drinks.vue
@@ -0,0 +1,673 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{item.shopName}}
+
+
+ {{item.distances}}
+
+
+
+
+
+ {{s.name}}
+
+
+
+
+
+
+
+
+
+ {{item.productName.length>7?item.productName.substring(0,7)+'...':item.productName}}
+ 已抢{{item.realSalesNumber}}份
+
+
+
+
+ {{c.name}}
+
+
+
+
+ 马上抢
+
+
+
+ 到手
+ ¥{{item.salePrice}}
+
+
+ {{item.discount || ''}}折
+
+
+ ¥{{item.originPrice}}
+
+
+
+ 共省{{item.save}}元
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/index/freedaily.vue b/pages/index/freedaily.vue
new file mode 100644
index 0000000..2cffa2c
--- /dev/null
+++ b/pages/index/freedaily.vue
@@ -0,0 +1,377 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{item.userName}}* 免单{{item.orderAmount}}元订单号:{{item.orderNo}}
+
+
+
+
+
+
+
+
+
+ 订单数:{{total}}
+
+
+
+
+
+ 免单状态
+
+
+ 订单号
+
+
+ 金额
+
+
+
+
+
+ {{item.isRefund == true ? '已免单':'待免单'}}
+
+
+ {{item.orderNo}}
+
+
+ {{item.orderAmount}}元
+
+
+
+
+
+
+
+
+ 注:每笔订单完成后30天内均有机会获得免单
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/index/index.vue b/pages/index/index.vue
index 2bdd403..6cfdfcd 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -5,7 +5,8 @@
-
+
+
@@ -22,16 +23,20 @@
-
+ :class="!item.isChild && viewHistoryindex == index ? 'fourcontent_itemactev':''">
{{item.name}}
-
+
+
+
+
+
@@ -129,10 +134,9 @@
-
-
+
@@ -141,7 +145,10 @@
ref,
computed,
onMounted,
- reactive
+ reactive,
+ onBeforeUnmount,
+ watch,
+ getCurrentInstance
} from "vue";
import {
onLoad,
@@ -150,21 +157,27 @@
onReachBottom,
onPageScroll
} from '@dcloudio/uni-app'
+ // 获取全局属性
+ const {
+ proxy
+ } = getCurrentInstance();
import swipers from './components/swiper.vue' //引入轮播
import advertisement from './components/advertisement.vue' //广告
import diamond from './components/diamond.vue' //金刚区
import todaylist from './components/todaylist.vue' //今日上线
- // import popupad from '@/components/popupad.vue'
- // import productlist from './components/productlist.vue'
- // import category from '@/components/qiyue-category/qiyue-category.vue';
- // import indexs from './indexs.vue';
+ import indexs from './indexs.vue';
+ import AreaSelect from './components/AreaSelect.vue'; //城市联动
+ import grouping from './components/grouping.vue'; //其他
import Nav from '@/components/indexnav.vue'; //导航栏
- import API from "@/common/js/api.js"
+ import {
+ APIhomehomePageUp,
+ APIhome,
+ APIshopUserInfo
+ } from "@/common/api/index/index.js"
import {
useNavbarStore
} from '@/stores/navbarStore';
const store = useNavbarStore();
-
// 动态更新导航栏配置
store.updateNavbarConfig({
showBack: true, //左边返回键
@@ -178,8 +191,8 @@
const showindex = ref('index')
//计算广告图片的重合尺寸是位移
const getStyle = (e) => {
- if (e > hometoplist.bannerVO.counponsInfo.length / 2) {
- var right = hometoplist.bannerVO.counponsInfo.length - e
+ if (e > hometoplist.bannervo.counponsInfo.length / 2) {
+ var right = hometoplist.bannervo.counponsInfo.length - e
return {
transform: 'scale(' + (1) + ') translate(-' + (right * 20) + '%,0px)',
zIndex: 9999 - right,
@@ -193,20 +206,22 @@
}
}
}
- const advertisementStyle = ref([{
- transform: 'scale(' + (1) + ') translate(-' + (0 * 20) + '%,0px)',
- zIndex: 9999,
- opacity: 1
- }])
+ const advertisementStyle = ref([])
+ const refbannervo = ref(null);
//数据
- const hometoplist = reactive({})
+ const hometoplist = reactive({
+ bannervo: {
+ counponsInfo: [],
+ coupons: ''
+ }
+ })
// 首页上面数据
const hometop = async () => {
try {
- let res = await API.homehomePageUp()
+ let res = await APIhomehomePageUp()
Object.assign(hometoplist, res.data)
- if (hometoplist.bannerVO.counponsInfo) {
- hometoplist.bannerVO.counponsInfo.forEach((item, index) => {
+ if (hometoplist.bannervo.counponsInfo) {
+ hometoplist.bannervo.counponsInfo.forEach((item, index) => {
advertisementStyle.value.push(getStyle(index))
})
}
@@ -232,7 +247,7 @@
const homelist = ref([]) //接收数据
const onLoadhome = async () => {
try {
- let res = await API.home(formhomelist)
+ let res = await APIhome(formhomelist)
var dates = new Date().getTime();
res.data.list.forEach((item, index) => {
var leftTime = item.endTime - dates; //计算两日期之间相差的毫秒数
@@ -288,16 +303,21 @@
})
onLoadhome()
}
- const updateCity = async (data) => {
- console.log(data)
- // this.list[data].end_times = 0;
- }
+ // 弹出层处理
+ const showproductlist = ref(false);
+ // 定义方法
+ const openproductlist = (e) => {
+ hometoplist.menu[viewHistoryindex.value].name = e //下标更改name
+ showproductlist.value = !showproductlist.value
+ }
// 存储每个元素距离顶部的距离
const elementTop = ref(0);
// 存储是否吸顶的状态
const isSticky = ref(true);
+ //下标
+ const viewHistoryindex = ref(null)
// 点击滑动元素
const viewHistory = async (item, index) => {
if (isSticky) {
@@ -306,7 +326,12 @@
duration: 300
});
}
-
+ // 是否有弹出层
+ if (item.isChild) {
+ showproductlist.value = showproductlist.value ? viewHistoryindex.value == index ? false : true : !
+ showproductlist.value
+ }
+ viewHistoryindex.value = index
}
// 滑动
onPageScroll((res) => {
@@ -315,86 +340,71 @@
});
onShow(() => {})
onMounted(async () => {
- // 获取初始定位高度
- setTimeout(() => {
- const query = uni.createSelectorQuery().select('#fourcontent');
- query.boundingClientRect((rect) => {
- console.log(rect.top, 111)
- elementTop.value = rect.top - store.height
- }).exec();
- }, 500)
- // 查询是否有无内存
+ await proxy.$onLaunched;
+ console.log(uni.cache.get('shopId'))
if (uni.cache.get('shopId') && uni.cache.get('token')) {
showindex.value = 'shopIndex'
- uni.cache.set('types', 'index');
- let res = await API.shopUserInfo({
+ let res = await APIshopUserInfo({
"shopId": uni.cache.get('shopId'),
- "userId": uni.cache.get('userInfo').id,
+ "userId": uni.getStorageSync('userInfo').id,
})
if (res.code == 0) {
- shopUserInfo = res.data
- // uni.cache.set('shopUserInfo', this.shopUserInfo)
+ //商家信息
+ uni.cache.set('shopUserInfo', res.data)
}
- if (uni.cache.get('forceUpdate') == 1) {
- // this.forceUpdate = !this.forceUpdate;
- }
- // this.getShopExtend()
} else {
- uni.getLocation({
- type: 'wgs84',
- success: async (res) => {
- // console.log(res)
- let successres = await API.geocodelocation({
- lng: res.longitude,
- lat: res.latitude,
- })
- if (successres.code == 0) {
- let datastorage = {
- country: successres.data.addressComponent.country, // "中国"
- province: successres.data.addressComponent
- .province, //province: "陕西省"
- address: successres.data.addressComponent.city, //district: "西安市"
- district: successres.data.addressComponent
- .district, //district: "未央区"
- lng: res.longitude,
- lat: res.latitude,
- }
- uni.cache.set('getLocationstorage', datastorage);
- }
- },
- fail: async (err) => {
- showindex.value = 'index'
- }
- });
+ hometop()
+ init_fn()
+ showindex.value = 'index'
+ // 获取初始定位高度
+ setTimeout(() => {
+ const query = uni.createSelectorQuery().select('#fourcontent');
+ query.boundingClientRect((rect) => {
+ elementTop.value = rect.top - store.height
+ }).exec();
+ }, 500)
}
- hometop()
- init_fn()
-
-
});
+
onReachBottom(() => {
onLoadhome()
})
- onLoad(() => {
- })
+ // 页面离开时清除定时器
+ // onBeforeUnmount(() => {
+ // if (refbannervo.value) {
+ // refbannervo.value.clearTimer();
+ // }
+ // });
-
\ No newline at end of file
diff --git a/pages/index/tothestore.vue b/pages/index/tothestore.vue
new file mode 100644
index 0000000..3360fe3
--- /dev/null
+++ b/pages/index/tothestore.vue
@@ -0,0 +1,335 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 热销TOP{{index}}
+
+
+ {{item.shopName}}
+
+
+
+
+
+ {{item.address.length>7?item.address.substring(0,7)+'...':item.address}}
+
+
+ {{item.distances}}
+
+
+
+
+
+ 马上预约
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/product/index.vue b/pages/product/index.vue
new file mode 100644
index 0000000..c0921fa
--- /dev/null
+++ b/pages/product/index.vue
@@ -0,0 +1,47 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/user/address/edit.vue b/pages/user/address/edit.vue
new file mode 100644
index 0000000..a4bad07
--- /dev/null
+++ b/pages/user/address/edit.vue
@@ -0,0 +1,321 @@
+
+
+
+
+
+ 联系人
+
+
+
+
+
+
+
+ 联系电话
+
+
+
+
+
+
+
+
+ 所在地区
+
+
+
+
+
+
+
+
+
+
+ 详细地址
+
+
+
+
+
+
+
+
+ 设为默认地址
+
+
+
+
+ 保存
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/user/address/index.vue b/pages/user/address/index.vue
new file mode 100644
index 0000000..b30cfc4
--- /dev/null
+++ b/pages/user/address/index.vue
@@ -0,0 +1,244 @@
+
+
+
+
+
+ {{item.name}}
+
+
+ {{item.mobile.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2')}}
+
+
+
+ {{item.province}}{{item.area}}{{item.city}}{{item.address}}
+
+
+
+
+
+
+
+ 默认地址
+
+
+ 编辑
+ 删除
+
+
+
+
+
+ 添加地址
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/user/coupon.vue b/pages/user/coupon.vue
new file mode 100644
index 0000000..b91d16d
--- /dev/null
+++ b/pages/user/coupon.vue
@@ -0,0 +1,659 @@
+
+
+
+
+
+ {{item.name}}
+
+
+
+
+
+
+
+
+
+
+
+
+ {{item.num || 0}}
+ 张
+
+
+ ¥
+ {{item.discountAmount || 0}}
+
+
+
+
+ {{ item.type == 2 ? item.name : '优惠券(元)'}}
+
+
+
+
+
+
+
+ {{ item.shopName }}
+
+ 无门槛使用
+
+
+ {{ item.type == 2 ? '会员商品券' : item.name}}
+
+ {{status == 1 ? '去使用':'已使用'}}
+
+
+
+ 有效期至:{{$u.timeFormat(item.endTime, 'yyyy/mm/dd') || '0'}}
+
+
+
+
+
+
+
+
+
+
+ 暂不使用券
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/user/my_info.vue b/pages/user/my_info.vue
new file mode 100644
index 0000000..112123e
--- /dev/null
+++ b/pages/user/my_info.vue
@@ -0,0 +1,453 @@
+
+
+
+
+
+
+ 头像
+
+
+
+
+
+
+
+
+
+
+
+
+ 昵称
+
+
+
+
+
+ 账号
+
+
+
+
+
+ 性别
+
+ {{sexText}}
+
+
+
+
+
+ 生日
+
+ {{ birthDay || '生日一旦填写不能修改'}}
+
+
+
+
+
+
+
+
+ 绑定微信
+
+ 已绑定
+
+
+
+
+
+ 保存
+
+
+
+
+
+
diff --git a/pages/user/repairpassword.vue b/pages/user/repairpassword.vue
new file mode 100644
index 0000000..18c4187
--- /dev/null
+++ b/pages/user/repairpassword.vue
@@ -0,0 +1,254 @@
+
+
+ 安全密码用于商户推广提现/订单退款,确保资金安全
+
+
+ 手机号码
+
+
+
+ 密码
+
+
+
+ 确认密码
+
+
+
+ 验证码
+
+
+ {{ Recapture }}
+
+ {{ second }}s重新发送
+
+
+
+
+
+ 确定
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/user/repairpasswordtwo.vue b/pages/user/repairpasswordtwo.vue
new file mode 100644
index 0000000..aa857be
--- /dev/null
+++ b/pages/user/repairpasswordtwo.vue
@@ -0,0 +1,223 @@
+
+
+
+
+ {{form.password.length == 6?'请再次确认支付密码':"请设置新密码,用于支付验证"}}
+
+
+
+ {{consumeFee.slice(0,1)}}
+
+
+ {{consumeFee.slice(1,2)}}
+
+
+ {{consumeFee.slice(2,3)}}
+
+
+ {{consumeFee.slice(3,4)}}
+
+
+ {{consumeFee.slice(4,5)}}
+
+
+ {{consumeFee.slice(5,6)}}
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/user/shop/confirm.vue b/pages/user/shop/confirm.vue
new file mode 100644
index 0000000..2f3c94b
--- /dev/null
+++ b/pages/user/shop/confirm.vue
@@ -0,0 +1,692 @@
+
+
+
+
+
+ 商品信息
+
+
+
+
+
+
+
+
+ {{item.title || '无'}}
+
+
+ {{item.spec || '无'}}
+
+
+
+
+
+ {{item.price || '无'}}
+
+
+ ×{{item.number || '无'}}
+
+
+
+
+
+
+
+
+
+ 确认地址
+
+
+
+
+
+ {{elist.address.address}}
+
+
+ {{elist.address.province}}-{{elist.address.city}}-{{elist.address.area}}-{{elist.address.address}}
+
+
+ {{elist.address.name}}{{elist.address.mobile}}
+
+
+
+
+ 去添加地址
+
+
+
+
+
+
+
+ 运费
+
+
+ ¥{{elist.freight}}
+
+
+
+
+ 合计
+
+
+ ¥{{elist.price.total_price}}
+
+
+
+
+
+
+
+ 支付方式
+
+
+
+
+
+
+ 微信支付
+
+
+
+
+
+
+
+
+
+
+
+ 余额支付
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 实付金额:
+
+
+ ¥{{elist.price.price}}
+
+
+
+ 立即付款
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/user/shop/detail.vue b/pages/user/shop/detail.vue
new file mode 100644
index 0000000..8374a9f
--- /dev/null
+++ b/pages/user/shop/detail.vue
@@ -0,0 +1,341 @@
+
+
+
+
+
+
+
+
+
+ 积分商城
+
+
+
+
+
+
+
+
+
+
+
+ 当前积分
+
+
+
+
+ 5830
+
+
+
+
+ 积分明细
+
+
+
+
+ 收入
+ /
+ 支出
+
+
+
+
+ 交易积分-线下收款
+ 2023-01-11 17:33:09
+
+ +0.02
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/user/shop/index.vue b/pages/user/shop/index.vue
new file mode 100644
index 0000000..22e5f99
--- /dev/null
+++ b/pages/user/shop/index.vue
@@ -0,0 +1,418 @@
+
+
+
+
+
+
+
+
+
+ 积分商城
+
+
+
+
+
+
+
+
+
+
+
+
+ 当前积分
+
+
+
+ 5830
+
+
+
+ 积分明细
+
+
+
+
+
+
+ 搜索
+
+
+
+
+
+
+
+ {{item.name}}
+
+
+
+
+
+
+ 澳洲高级洗发水
+
+
+
+
+ 30积分
+
+
+
+
+ 市场价¥100.00
+
+
+ 已兑换0390件
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/user/shop/shopinfo.vue b/pages/user/shop/shopinfo.vue
new file mode 100644
index 0000000..c84bfb5
--- /dev/null
+++ b/pages/user/shop/shopinfo.vue
@@ -0,0 +1,560 @@
+
+
+
+
+
+ 111
+
+
+
+
+ 当前积分
+
+
+
+
+
+
+ 商品详情
+
+
+
+
+
+
+
+
+
+
+
+ 首页
+
+
+
+ 客服
+
+
+
+
+ 立即购买
+
+
+
+
+
+
+
+
+
+
+ 贝尔纳干红葡萄酒
+
+
+
+ 当前积分
+
+
+
+
+
+
+
+
+
+
+ {{item.spec_name}}
+
+
+
+
+ {{item1.name}}
+
+
+
+
+
+
+ 购买数量
+
+
+
+
+
+
+
+ 合计
+
+
+ ¥100
+
+
+
+ 确定
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/user/user.vue b/pages/user/user.vue
new file mode 100644
index 0000000..4a66e6d
--- /dev/null
+++ b/pages/user/user.vue
@@ -0,0 +1,276 @@
+
+
+
+
+
+
+
+ {{userInfo.nickName || '无'}}
+
+
+
+
+ 免费入会
+
+
+
+
+
+ 我的资产
+
+
+
+ {{item.name}}
+ {{item.num || '**'}}
+
+
+
+
+
+ 我的功能
+
+
+
+
+ {{item.name}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/static/tabbar/1-1.png b/static/tabbar/1-1.png
new file mode 100644
index 0000000..f956a5e
Binary files /dev/null and b/static/tabbar/1-1.png differ
diff --git a/static/tabbar/1.png b/static/tabbar/1.png
new file mode 100644
index 0000000..335b742
Binary files /dev/null and b/static/tabbar/1.png differ
diff --git a/static/tabbar/2-1.png b/static/tabbar/2-1.png
new file mode 100644
index 0000000..6d77998
Binary files /dev/null and b/static/tabbar/2-1.png differ
diff --git a/static/tabbar/2.png b/static/tabbar/2.png
new file mode 100644
index 0000000..63973d1
Binary files /dev/null and b/static/tabbar/2.png differ
diff --git a/static/tabbar/3-1.png b/static/tabbar/3-1.png
new file mode 100644
index 0000000..5e14362
Binary files /dev/null and b/static/tabbar/3-1.png differ
diff --git a/static/tabbar/3.png b/static/tabbar/3.png
new file mode 100644
index 0000000..1f0b10a
Binary files /dev/null and b/static/tabbar/3.png differ
diff --git a/static/tabbar/4-1.png b/static/tabbar/4-1.png
new file mode 100644
index 0000000..e0e5ad2
Binary files /dev/null and b/static/tabbar/4-1.png differ
diff --git a/static/tabbar/4.png b/static/tabbar/4.png
new file mode 100644
index 0000000..9a197fe
Binary files /dev/null and b/static/tabbar/4.png differ
diff --git a/stores/navbarStore.js b/stores/navbarStore.js
index 357246e..2180679 100644
--- a/stores/navbarStore.js
+++ b/stores/navbarStore.js
@@ -1,45 +1,50 @@
-import { defineStore } from 'pinia';
-
+import {
+ defineStore
+} from 'pinia';
+import {
+ ref
+} from 'vue';
export const useNavbarStore = defineStore('navbar', {
- state: () => ({
- showBack: true,
- rightText: '',
- showSearch: false,
- title: '',
- isTransparent: false,
- height: 0,
- hasPlaceholder: true,
+ state: () => ({
+ showBack: true,
+ rightText: '',
+ showSearch: false,
+ title: '',
+ isTransparent: false,
+ height: 0,
+ hasPlaceholder: true,
scrollTop: 0 //滚动高度
- }),
- actions: {
- updateNavbarConfig(config) {
- Object.assign(this, config);
- },
- initNavbarHeight() {
- uni.getSystemInfo({
- success: (res) => {
- const statusBarHeight = res.statusBarHeight;
- let navBarHeight;
+ }),
+ actions: {
+ updateNavbarConfig(config) {
+ Object.assign(this, config);
+ },
+ initNavbarHeight() {
+ uni.getSystemInfo({
+ success: (res) => {
+ const statusBarHeight = res.statusBarHeight;
+ let navBarHeight;
- // 微信小程序的特殊处理
- if (res.platform === 'weapp') {
- const menuButtonInfo = uni.getMenuButtonBoundingClientRect();
- const topGap = menuButtonInfo.top - statusBarHeight;
- const bottomGap = statusBarHeight + menuButtonInfo.height + topGap * 2 - (menuButtonInfo.top + menuButtonInfo.height);
- navBarHeight = menuButtonInfo.height + topGap + bottomGap;
- } else if (uni.getSystemInfoSync().platform === 'ios') {
- navBarHeight = 44;
- } else {
- navBarHeight = 48;
- }
+ // 微信小程序的特殊处理
+ if (res.platform === 'weapp') {
+ const menuButtonInfo = uni.getMenuButtonBoundingClientRect();
+ const topGap = menuButtonInfo.top - statusBarHeight;
+ const bottomGap = statusBarHeight + menuButtonInfo.height + topGap * 2 - (
+ menuButtonInfo.top + menuButtonInfo.height);
+ navBarHeight = menuButtonInfo.height + topGap + bottomGap;
+ } else if (uni.getSystemInfoSync().platform === 'ios') {
+ navBarHeight = 44;
+ } else {
+ navBarHeight = 48;
+ }
- this.height = statusBarHeight + navBarHeight;
- },
- fail: (err) => {
- console.error('获取系统信息失败:', err);
- this.height = 64; // 失败时设置一个默认高度
- }
- });
- }
- }
+ this.height = statusBarHeight + navBarHeight;
+ },
+ fail: (err) => {
+ console.error('获取系统信息失败:', err);
+ this.height = 64; // 失败时设置一个默认高度
+ }
+ });
+ }
+ }
});
\ No newline at end of file
diff --git a/stores/share.js b/stores/share.js
new file mode 100644
index 0000000..4446941
--- /dev/null
+++ b/stores/share.js
@@ -0,0 +1,88 @@
+import {
+ defineStore
+} from 'pinia';
+import {
+ ref
+} from 'vue';
+import {
+ APIcustomlogin
+} from '@/common/api/api.js'
+
+export const Storelogin = defineStore('login', {
+ state: () => ({
+ token: '',
+ miniAppOpenId: '',
+ userInfo: ''
+ }),
+ actions: {
+ actionslogin() {
+ return new Promise((resolve, reject) => {
+ // #ifdef MP-WEIXIN
+ uni.login({
+ provider: 'weixin',
+ success: (data) => {
+ // 微信小程序环境
+ uni.getUserInfo({
+ provider: 'weixin',
+ success: async (infoRes) => {
+ let res = await APIcustomlogin({
+ code: data.code, //临时登录凭证
+ rawData: infoRes.rawData,
+ source: 'wechat'
+ })
+ if (res.code == 0) {
+ this.token = res.data.token
+ this.miniAppOpenId = res.data.userInfo
+ .miniAppOpenId
+ this.userInfo = res.data.userInfo
+ uni.cache.set('token', res.data.token);
+ uni.cache.set('miniAppOpenId', res.data
+ .userInfo
+ .miniAppOpenId)
+ uni.cache.set('userInfo', res.data
+ .userInfo);
+ }
+ resolve(true);
+ },
+ fail: (err) => {
+ reject(false);
+ }
+ });
+ }
+ });
+ // #endif
+ // #ifdef MP-ALIPAY
+ my.getAuthCode({
+ scopes: 'auth_base',
+ success: async (data) => {
+ console.log(data)
+ // 支付宝小程序环境
+ // my.getAuthUserInfo({
+ // success: async (infoRes) => {
+ let res = await APIcustomlogin({
+ code: data.authCode, //临时登录凭证
+ // rawData: JSON.stringify(infoRes),
+ source: 'alipay'
+ })
+ if (res.code == 0) {
+ this.token = res.data.token
+ this.miniAppOpenId = res.data.userInfo.miniAppOpenId
+ this.userInfo = res.data.userInfo
+ uni.cache.set('token', res.data.token);
+ uni.cache.set('miniAppOpenId', res.data.userInfo
+ .miniAppOpenId)
+ uni.cache.set('userInfo', res.data.userInfo);
+ resolve(true);
+ }
+ },
+ fail: (err) => {
+ reject(false);
+ }
+ });
+ }
+ });
+ // #endif
+ }).catch((e) => {});
+}
+}
+});
\ No newline at end of file