67 lines
1.9 KiB
JavaScript
67 lines
1.9 KiB
JavaScript
import { defineStore } from 'pinia';
|
||
import { computed,ref } from 'vue';
|
||
import { apiService } from "@/server/api.service";
|
||
export const useCounterStore = defineStore('counter',()=>{
|
||
//定义数据(state)
|
||
const openId = ref('');
|
||
const nikeName = ref('');
|
||
const key = ref('');
|
||
const phone = ref('');
|
||
const uid = ref('');
|
||
const token = ref('');
|
||
const statusHeight = ref(uni.getMenuButtonBoundingClientRect()['height']);
|
||
const headerHeight = ref(uni.getSystemInfoSync()['statusBarHeight']);
|
||
const statusBartop = ref(uni.getMenuButtonBoundingClientRect()['top']);
|
||
const ButtonWidth = ref(uni.getMenuButtonBoundingClientRect().width);
|
||
const ButtonHeight = ref(uni.getMenuButtonBoundingClientRect().height)
|
||
//登录授权
|
||
const wechatlogin = (params,query)=>{
|
||
return apiService.post(`api/front/wechat/authorize/program/login?code=${query}`,params)
|
||
}
|
||
//首页楼层
|
||
const frontindex = (params)=>{
|
||
return apiService.get('api/front/index',params)
|
||
}
|
||
//首页列表数据
|
||
const frontproduct = (type,params,token)=>{
|
||
return apiService.get(`api/front/product/${type}`,params,token)
|
||
}
|
||
//商品详情接口
|
||
const frontdetail = (type,params,token)=>{
|
||
return apiService.get(`api/front/product/detail/${type}`,params,token)
|
||
}
|
||
//商品详情评论列表
|
||
const replyproduct = (type,params,token)=>{
|
||
return apiService.get(`api/front/reply/product/${type}`,params,token)
|
||
}
|
||
//商品评论数量
|
||
const replyconfig = (type,params,token)=>{
|
||
return apiService.get(`api/front/reply/config/${type}`,params,token)
|
||
}
|
||
//商品评论数量
|
||
const replylist = (params,token)=>{
|
||
return apiService.get(`api/front/reply/list`,params,token)
|
||
}
|
||
|
||
|
||
//以对象的形式return供组件调用
|
||
return{
|
||
nikeName,
|
||
key,
|
||
token,
|
||
phone,
|
||
uid,
|
||
ButtonWidth,
|
||
ButtonHeight,
|
||
statusHeight,
|
||
headerHeight,
|
||
statusBartop,
|
||
wechatlogin,
|
||
frontindex,
|
||
frontproduct,
|
||
frontdetail,
|
||
replyproduct,
|
||
replyconfig,
|
||
replylist
|
||
}
|
||
}) |