Enzo 4 years ago
parent
commit
e11f1d75be
  1. 1
      common/api.js
  2. 51
      pages/index/index.vue

1
common/api.js

@ -8,6 +8,7 @@ export const PRODURL = ''; // 正式服请求地址
/* 首页相关接口 */ /* 首页相关接口 */
export const API_CATEGORY_LIST = '/api/category/list'; // 首页-分类 export const API_CATEGORY_LIST = '/api/category/list'; // 首页-分类
export const API_GOODS_LIST = '/api/goods/list'; // 首页-分类下商品列表 export const API_GOODS_LIST = '/api/goods/list'; // 首页-分类下商品列表
export const API_SHARE_HOME = '/api/share/home'; // 首页分享信息
// 用户订单 // 用户订单
export const API_USERORDER = '/api/order/list'; export const API_USERORDER = '/api/order/list';

51
pages/index/index.vue

@ -45,46 +45,20 @@
return { return {
tab_list: [], tab_list: [],
current: 0, // tab current: 0, // tab
pageSize: 10
pageSize: 10,
shareInfo: {}
} }
}, },
onLoad() { onLoad() {
this.getCategoryList(); this.getCategoryList();
// this.get();
this.getShareInfo();
}, },
methods: { methods: {
get(){
this.$http(this.API.TEST, {
goods_id: 1,
goods_specs_id: 1,
number: 1,
token: 'b1f20b424ec9e7a2a4c9788fd0f75643'
}).then(res => {
console.log(res)
// let nonceStr = res.data.nonceStr
// appId: "wxb35ef055a4dd8ad4"
// nonceStr: "60d3125d138af"
// order_num: "2842855348400816128"
// package: "prepay_id=wx23185213000285e14ea77ac97acc670000"
// paySign: "6DC330CBDF6C29BEDD4D254D9DA97364"
// signType: "MD5"
// timeStamp: "1624445533"
uni.requestPayment({
orderInfo: res.data.order_num,
timeStamp: res.data.timeStamp,
nonceStr: res.data.nonceStr,
package: res.data.package,
signType: res.data.signType,
paySign: res.data.paySign,
complete: result => {
console.log(result)
}
})
})
//
getShareInfo(){
this.$http(this.API.API_SHARE_HOME).then(res => {
this.shareInfo = res.data;
});
}, },
// tab // tab
change(index) { change(index) {
@ -160,10 +134,15 @@
uni.stopPullDownRefresh() uni.stopPullDownRefresh()
}, },
onShareAppMessage(){ onShareAppMessage(){
return {
title: '分享小程序',
let shareInfo = {
title: this.shareInfo.title || '欢迎使用时空网小程序',
path: '/pages/route/index?route=home' path: '/pages/route/index?route=home'
} }
if(this.shareInfo.cover){
shareInfo.imageUrl = this.shareInfo.cover;
}
return shareInfo;
} }
} }
</script> </script>

Loading…
Cancel
Save