Commit e73f061a authored by Menethil's avatar Menethil
Browse files

添加小程序朋友圈分享,朋友分享,并实现首页自动跳转

parent 0881acf4
...@@ -22,11 +22,6 @@ ...@@ -22,11 +22,6 @@
</el-form-item> </el-form-item>
<el-button type="primary" style="width:100%;margin-bottom:30px;" :loading="loading" @click.native.prevent="handleLogin">登录</el-button> <el-button type="primary" style="width:100%;margin-bottom:30px;" :loading="loading" @click.native.prevent="handleLogin">登录</el-button>
<div class="tips">
<span>管理员用户名 : admin123</span>
<span>管理员密码 : admin123</span>
</div>
</el-form> </el-form>
</div> </div>
...@@ -52,8 +47,8 @@ export default { ...@@ -52,8 +47,8 @@ export default {
} }
return { return {
loginForm: { loginForm: {
username: 'admin123', username: '',
password: 'admin123' password: ''
}, },
loginRules: { loginRules: {
username: [{ required: true, trigger: 'blur', validator: validateUsername }], username: [{ required: true, trigger: 'blur', validator: validateUsername }],
......
// 以下是业务服务器API地址 // 以下是业务服务器API地址
// 本机开发时使用 // 本机开发时使用
var WxApiRoot = 'http://localhost:8082/wx/'; // var WxApiRoot = 'http://localhost:8082/wx/';
// 局域网测试使用 // 局域网测试使用
// var WxApiRoot = 'http://192.168.0.101:8082/wx/'; // var WxApiRoot = 'http://192.168.0.101:8082/wx/';
// 云平台部署时使用 // 云平台部署时使用
// var WxApiRoot = 'http://122.152.206.172:8082/wx/'; // var WxApiRoot = 'http://122.152.206.172:8082/wx/';
// 云平台上线时使用 // 云平台上线时使用
// var WxApiRoot = 'https://www.menethil.com.cn/wx/'; var WxApiRoot = 'https://www.menethil.com.cn/wx/';
module.exports = { module.exports = {
IndexUrl: WxApiRoot + 'home/index', //首页数据接口 IndexUrl: WxApiRoot + 'home/index', //首页数据接口
......
...@@ -25,6 +25,7 @@ Page({ ...@@ -25,6 +25,7 @@ Page({
noCollectImage: '/static/images/icon_collect.png', noCollectImage: '/static/images/icon_collect.png',
hasCollectImage: '/static/images/icon_collect_checked.png', hasCollectImage: '/static/images/icon_collect_checked.png',
collectImage: '/static/images/icon_collect.png', collectImage: '/static/images/icon_collect.png',
shareImage: '',
soldout: false soldout: false
}, },
...@@ -35,6 +36,39 @@ Page({ ...@@ -35,6 +36,39 @@ Page({
wx.stopPullDownRefresh() //停止下拉刷新 wx.stopPullDownRefresh() //停止下拉刷新
}, },
saveShare: function() {
let that = this;
wx.downloadFile({
url: that.data.shareImage,
success: function(res) {
console.log(res)
wx.saveImageToPhotosAlbum({
filePath: res.tempFilePath,
success: function(res) {
wx.showModal({
title: '存图成功',
content: '图片成功保存到相册了,可以分享到朋友圈了',
showCancel: false,
confirmText: '好的',
confirmColor: '#a78845',
success: function(res) {
if (res.confirm) {
console.log('用户点击确定');
}
}
})
},
fail: function(res) {
console.log('fail')
}
})
},
fail: function() {
console.log('fail')
}
})
},
getGoodsInfo: function() { getGoodsInfo: function() {
let that = this; let that = this;
util.request(api.GoodsDetail, { util.request(api.GoodsDetail, {
...@@ -72,6 +106,7 @@ Page({ ...@@ -72,6 +106,7 @@ Page({
specificationList: res.data.specificationList, specificationList: res.data.specificationList,
productList: res.data.productList, productList: res.data.productList,
userHasCollect: res.data.userHasCollect, userHasCollect: res.data.userHasCollect,
shareImage: res.data.shareImage,
checkedSpecPrice: res.data.info.retailPrice checkedSpecPrice: res.data.info.retailPrice
}); });
......
...@@ -5,9 +5,8 @@ ...@@ -5,9 +5,8 @@
</swiper-item> </swiper-item>
</swiper> </swiper>
<view class="service-policy"> <view class="service-policy">
<view class="item">30天无忧退货</view> <button class="savesharebtn" bindtap="saveShare">分享朋友圈</button>
<view class="item">48小时快速退款</view> <button class="sharebtn" open-type="share">分享给朋友</button>
<view class="item">满88元免邮费</view>
</view> </view>
<view class="goods-info"> <view class="goods-info">
<view class="c"> <view class="c">
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
height: 750rpx; height: 750rpx;
} }
.service-policy { /* .service-policy {
width: 750rpx; width: 750rpx;
height: 73rpx; height: 73rpx;
background: #f4f4f4; background: #f4f4f4;
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
align-items: center; align-items: center;
font-size: 25rpx; font-size: 25rpx;
color: #666; color: #666;
} } */
.goods-info { .goods-info {
width: 750rpx; width: 750rpx;
...@@ -782,3 +782,45 @@ ...@@ -782,3 +782,45 @@
color: #fff; color: #fff;
text-align: center; text-align: center;
} }
.service-policy {
width: 100%;
height: 96rpx;
/* background: #d3b676; */
border: 2px solid #fff;
/* align-items: center; */
}
.service-policy .sharebtn {
width: 49.5%;
float: right;
border: none;
height: 80rpx;
font-size: 32rpx;
background: #d3b676;
text-align: center;
color: #fff;
border-radius:0%;
}
.service-policy .sharebtn::after {
border: none;
border-radius:0%;
}
.service-policy .savesharebtn {
width: 49.5%;
float: left;
border: none;
height: 80rpx;
font-size: 32rpx;
background: #d3b676;
text-align: center;
color: #fff;
border-radius:0%;
}
.service-policy .savesharebtn::after {
border: none;
border-radius:0%;
}
\ No newline at end of file
...@@ -14,6 +14,7 @@ Page({ ...@@ -14,6 +14,7 @@ Page({
banner: [], banner: [],
channel: [] channel: []
}, },
onShareAppMessage: function() { onShareAppMessage: function() {
return { return {
title: 'litemall小程序商场', title: 'litemall小程序商场',
...@@ -46,6 +47,33 @@ Page({ ...@@ -46,6 +47,33 @@ Page({
}); });
}, },
onLoad: function(options) { onLoad: function(options) {
// 页面初始化 options为页面跳转所带来的参数
if (options.scene) {
//这个scene的值存在则证明首页的开启来源于朋友圈分享的图,同时可以通过获取到的goodId的值跳转导航到对应的详情页
var scene = decodeURIComponent(options.scene);
console.log("scene:" + scene);
wx.navigateTo({
url: '../goods/goods?id=' + scene
});
}
// 页面初始化 options为页面跳转所带来的参数
if (options.goodId) {
//这个goodId的值存在则证明首页的开启来源于分享,同时可以通过获取到的goodId的值跳转导航到对应的详情页
wx.navigateTo({
url: '../goods/goods?id=' + options.goodId
});
}
// 页面初始化 options为页面跳转所带来的参数
if (options.orderId) {
//这个orderId的值存在则证明首页的开启来源于订单模版通知,同时可以通过获取到的pageId的值跳转导航到对应的详情页
wx.navigateTo({
url: '../ucenter/orderDetail/orderDetail?id=' + options.orderId
});
}
this.getIndexData(); this.getIndexData();
}, },
onReady: function() { onReady: function() {
......
Supports Markdown
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