支付增加订阅功能,增加海报生成传递from类型
This commit is contained in:
@ -15,23 +15,16 @@
|
||||
</view>
|
||||
<view class="info-wrapper">
|
||||
<view class="picList acea-row row-between mt-20">
|
||||
<view
|
||||
class="pic-box pic-box-color acea-row row-center-wrapper row-column"
|
||||
:class="activePic === index ? 'pic-box-color-active' : ''"
|
||||
v-for="(item, index) in picList"
|
||||
:key="index"
|
||||
@click="picCharge(index, item)"
|
||||
>
|
||||
<view class="pic-box pic-box-color acea-row row-center-wrapper row-column"
|
||||
:class="activePic === index ? 'pic-box-color-active' : ''" v-for="(item, index) in picList" :key="index"
|
||||
@click="picCharge(index, item)">
|
||||
<view class="pic-number-pic">
|
||||
<text>
|
||||
{{ item.value.price }}
|
||||
<text class="pic-number">元</text>
|
||||
</text>
|
||||
</view>
|
||||
<view
|
||||
class="pic-number"
|
||||
v-if="item.value.give_price > 0"
|
||||
>赠送:{{ item.value.give_price }} 元</view>
|
||||
<view class="pic-number" v-if="item.value.give_price > 0">赠送:{{ item.value.give_price }} 元</view>
|
||||
</view>
|
||||
<!-- <view
|
||||
class="pic-box pic-box-color acea-row row-center-wrapper"
|
||||
@ -52,293 +45,335 @@
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import { mapGetters } from "vuex";
|
||||
import { weappPay } from "@/libs/wechat";
|
||||
import { rechargeWechat, getRechargeApi } from "@/api/user";
|
||||
import { add, sub } from "@/utils/bc";
|
||||
import {
|
||||
mapGetters
|
||||
} from "vuex";
|
||||
import {
|
||||
weappPay
|
||||
} from "@/libs/wechat";
|
||||
import {
|
||||
rechargeWechat,
|
||||
getRechargeApi
|
||||
} from "@/api/user";
|
||||
import {
|
||||
add,
|
||||
sub
|
||||
} from "@/utils/bc";
|
||||
import {
|
||||
subscribeMessage
|
||||
} from "@/libs/order";
|
||||
|
||||
export default {
|
||||
name: "Recharge",
|
||||
components: {},
|
||||
props: {},
|
||||
data: function () {
|
||||
return {
|
||||
active: 0,
|
||||
from: this.$deviceType,
|
||||
money: "",
|
||||
now_money: "",
|
||||
picList: [],
|
||||
activePic: 0,
|
||||
numberPic: "",
|
||||
paid_price: "",
|
||||
rechar_id: 0,
|
||||
};
|
||||
},
|
||||
computed: mapGetters(["userInfo"]),
|
||||
mounted: function () {
|
||||
this.now_money = this.userInfo.nowMoney;
|
||||
this.getRecharge();
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 充值额度选择
|
||||
*/
|
||||
getRecharge() {
|
||||
getRechargeApi()
|
||||
.then((res) => {
|
||||
this.picList = res.data.recharge_price_ways || [];
|
||||
if (this.picList[0]) {
|
||||
this.rechar_id = this.picList[0].id;
|
||||
this.paid_price = this.picList[0].value.price;
|
||||
this.numberPic = this.picList[0].value.give_price;
|
||||
}
|
||||
})
|
||||
.catch((res) => {
|
||||
uni.showToast({
|
||||
title:
|
||||
err.msg || err.response.data.msg || err.response.data.message,
|
||||
icon: "none",
|
||||
duration: 2000,
|
||||
});
|
||||
});
|
||||
|
||||
export default {
|
||||
name: "Recharge",
|
||||
components: {},
|
||||
props: {},
|
||||
data: function () {
|
||||
return {
|
||||
active: 0,
|
||||
from: this.$deviceType,
|
||||
money: "",
|
||||
now_money: "",
|
||||
picList: [],
|
||||
activePic: 0,
|
||||
numberPic: "",
|
||||
paid_price: "",
|
||||
rechar_id: 0,
|
||||
};
|
||||
},
|
||||
/**
|
||||
* 选择金额
|
||||
*/
|
||||
picCharge(idx, item) {
|
||||
this.activePic = idx;
|
||||
if (idx == this.picList.length) {
|
||||
this.rechar_id = 0;
|
||||
this.paid_price = "";
|
||||
this.numberPic = "";
|
||||
} else {
|
||||
this.money = "";
|
||||
this.rechar_id = item.id;
|
||||
this.paid_price = item.value.give_price;
|
||||
this.numberPic = item.value.price;
|
||||
}
|
||||
computed: mapGetters(["userInfo"]),
|
||||
mounted: function () {
|
||||
this.now_money = this.userInfo.nowMoney;
|
||||
this.getRecharge();
|
||||
},
|
||||
recharge: function () {
|
||||
let that = this,
|
||||
price = Number(this.money);
|
||||
if (this.picList.length == this.activePic && price === 0) {
|
||||
uni.showToast({
|
||||
title: "请输入您要充值的金额",
|
||||
icon: "none",
|
||||
duration: 2000,
|
||||
});
|
||||
return;
|
||||
} else if (this.picList.length == this.activePic && price < 0.01) {
|
||||
uni.showToast({
|
||||
title: "充值金额不能低于0.01",
|
||||
icon: "none",
|
||||
duration: 2000,
|
||||
});
|
||||
return;
|
||||
} else if (this.picList.length == this.activePic && price > 99999) {
|
||||
uni.showToast({
|
||||
title: "充值金额不能大于99999",
|
||||
icon: "none",
|
||||
duration: 2000,
|
||||
});
|
||||
return;
|
||||
}
|
||||
let prices = "",
|
||||
paid_price = "";
|
||||
if (price) {
|
||||
prices = price;
|
||||
paid_price = 0;
|
||||
} else {
|
||||
prices = that.numberPic;
|
||||
paid_price = that.paid_price;
|
||||
}
|
||||
rechargeWechat({
|
||||
price: prices,
|
||||
from: that.from,
|
||||
paid_price: paid_price,
|
||||
rechar_id: that.rechar_id,
|
||||
})
|
||||
.then((res) => {
|
||||
console.log(res);
|
||||
var data = res.data.data;
|
||||
weappPay(res.data.data)
|
||||
.then(() => {
|
||||
prices = add(prices, paid_price);
|
||||
that.now_money = add(prices, parseFloat(that.userInfo.nowMoney));
|
||||
uni.showToast({
|
||||
title: "支付成功",
|
||||
icon: "success",
|
||||
duration: 2000,
|
||||
});
|
||||
this.$yrouter.back();
|
||||
})
|
||||
.finally((res) => {
|
||||
//if(typeof(res) == "undefined") return
|
||||
uni.showToast({
|
||||
title: res,
|
||||
icon: "none",
|
||||
duration: 2000,
|
||||
});
|
||||
})
|
||||
.catch(function () {
|
||||
uni.showToast({
|
||||
title: "支付失败",
|
||||
icon: "none",
|
||||
duration: 2000,
|
||||
});
|
||||
methods: {
|
||||
/**
|
||||
* 充值额度选择
|
||||
*/
|
||||
getRecharge() {
|
||||
getRechargeApi()
|
||||
.then((res) => {
|
||||
this.picList = res.data.recharge_price_ways || [];
|
||||
if (this.picList[0]) {
|
||||
this.rechar_id = this.picList[0].id;
|
||||
this.paid_price = this.picList[0].value.price;
|
||||
this.numberPic = this.picList[0].value.give_price;
|
||||
}
|
||||
})
|
||||
.catch((res) => {
|
||||
uni.showToast({
|
||||
title: err.msg || err.response.data.msg || err.response.data.message,
|
||||
icon: "none",
|
||||
duration: 2000,
|
||||
});
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 选择金额
|
||||
*/
|
||||
picCharge(idx, item) {
|
||||
this.activePic = idx;
|
||||
if (idx == this.picList.length) {
|
||||
this.rechar_id = 0;
|
||||
this.paid_price = "";
|
||||
this.numberPic = "";
|
||||
} else {
|
||||
this.money = "";
|
||||
this.rechar_id = item.id;
|
||||
this.paid_price = item.value.give_price;
|
||||
this.numberPic = item.value.price;
|
||||
}
|
||||
},
|
||||
recharge: function () {
|
||||
let that = this,
|
||||
price = Number(this.money);
|
||||
if (this.picList.length == this.activePic && price === 0) {
|
||||
uni.showToast({
|
||||
title:
|
||||
err.msg || err.response.data.msg || err.response.data.message,
|
||||
title: "请输入您要充值的金额",
|
||||
icon: "none",
|
||||
duration: 2000,
|
||||
});
|
||||
});
|
||||
return;
|
||||
} else if (this.picList.length == this.activePic && price < 0.01) {
|
||||
uni.showToast({
|
||||
title: "充值金额不能低于0.01",
|
||||
icon: "none",
|
||||
duration: 2000,
|
||||
});
|
||||
return;
|
||||
} else if (this.picList.length == this.activePic && price > 99999) {
|
||||
uni.showToast({
|
||||
title: "充值金额不能大于99999",
|
||||
icon: "none",
|
||||
duration: 2000,
|
||||
});
|
||||
return;
|
||||
}
|
||||
let prices = "",
|
||||
paid_price = "";
|
||||
if (price) {
|
||||
prices = price;
|
||||
paid_price = 0;
|
||||
} else {
|
||||
prices = that.numberPic;
|
||||
paid_price = that.paid_price;
|
||||
}
|
||||
rechargeWechat({
|
||||
price: prices,
|
||||
from: this.$deviceType == 'weixin' || this.$deviceType == 'weixinh5' ? 'uniappH5' : this.$deviceType,
|
||||
paid_price: paid_price,
|
||||
rechar_id: that.rechar_id,
|
||||
})
|
||||
.then((res) => {
|
||||
console.log(res);
|
||||
var data = res.data.data;
|
||||
weappPay(res.data.data)
|
||||
.then(() => {
|
||||
prices = add(prices, paid_price);
|
||||
that.now_money = add(prices, parseFloat(that.userInfo.nowMoney));
|
||||
uni.showToast({
|
||||
title: "支付成功",
|
||||
icon: "success",
|
||||
duration: 2000,
|
||||
});
|
||||
// #ifdef MP-WEIXIN
|
||||
subscribeMessage()
|
||||
// #endif
|
||||
this.$yrouter.back();
|
||||
})
|
||||
.finally((res) => {
|
||||
//if(typeof(res) == "undefined") return
|
||||
uni.showToast({
|
||||
title: res,
|
||||
icon: "none",
|
||||
duration: 2000,
|
||||
});
|
||||
})
|
||||
.catch(function () {
|
||||
uni.showToast({
|
||||
title: "支付失败",
|
||||
icon: "none",
|
||||
duration: 2000,
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
uni.showToast({
|
||||
title: err.msg || err.response.data.msg || err.response.data.message,
|
||||
icon: "none",
|
||||
duration: 2000,
|
||||
});
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
#iframe {
|
||||
display: none;
|
||||
}
|
||||
.pic-box-color-active {
|
||||
background-color: #eb3729 !important;
|
||||
color: #fff !important;
|
||||
}
|
||||
.picList {
|
||||
margin-bottom: 0.3 * 100rpx;
|
||||
margin-top: 0.3 * 100rpx;
|
||||
}
|
||||
.font-color {
|
||||
color: #e83323;
|
||||
}
|
||||
.recharge {
|
||||
border-radius: 0.1 * 100rpx;
|
||||
width: 100%;
|
||||
background-color: #fff;
|
||||
margin: 0.2 * 100rpx auto 0 auto;
|
||||
padding: 0.3 * 100rpx;
|
||||
border-top-right-radius: 0.39 * 100rpx;
|
||||
border-top-left-radius: 0.39 * 100rpx;
|
||||
margin-top: -0.45 * 100rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.recharge .nav {
|
||||
height: 0.75 * 100rpx;
|
||||
line-height: 0.75 * 100rpx;
|
||||
padding: 0 1 * 100rpx;
|
||||
}
|
||||
.recharge .nav .item {
|
||||
font-size: 0.3 * 100rpx;
|
||||
color: #333;
|
||||
}
|
||||
.recharge .nav .item.on {
|
||||
font-weight: bold;
|
||||
border-bottom: 0.04 * 100rpx solid #e83323;
|
||||
}
|
||||
.recharge .info-wrapper {
|
||||
}
|
||||
.recharge .info-wrapper .money {
|
||||
margin-top: 0.6 * 100rpx;
|
||||
padding-bottom: 0.2 * 100rpx;
|
||||
border-bottom: 1px dashed #ddd;
|
||||
text-align: center;
|
||||
}
|
||||
.recharge .info-wrapper .money span {
|
||||
font-size: 0.56 * 100rpx;
|
||||
color: #333;
|
||||
font-weight: bold;
|
||||
}
|
||||
.recharge .info-wrapper .money input {
|
||||
display: inline-block;
|
||||
width: 3 * 100rpx;
|
||||
font-size: 0.84 * 100rpx;
|
||||
text-align: center;
|
||||
color: #282828;
|
||||
font-weight: bold;
|
||||
padding-right: 0.7 * 100rpx;
|
||||
}
|
||||
.recharge .info-wrapper .money input::placeholder {
|
||||
color: #ddd;
|
||||
}
|
||||
.recharge .info-wrapper .money input::-webkit-input-placeholder {
|
||||
color: #ddd;
|
||||
}
|
||||
.recharge .info-wrapper .money input:-moz-placeholder {
|
||||
color: #ddd;
|
||||
}
|
||||
.recharge .info-wrapper .money input::-moz-placeholder {
|
||||
color: #ddd;
|
||||
}
|
||||
.recharge .info-wrapper .money input:-ms-input-placeholder {
|
||||
color: #ddd;
|
||||
}
|
||||
.tip {
|
||||
font-size: 0.28 * 100rpx;
|
||||
color: #333333;
|
||||
font-weight: 800;
|
||||
margin-bottom: 0.14 * 100rpx;
|
||||
}
|
||||
.recharge .info-wrapper .tips span {
|
||||
color: #ef4a49;
|
||||
}
|
||||
.recharge .info-wrapper .pay-btn {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 0.86 * 100rpx;
|
||||
margin: 0.5 * 100rpx auto 0 auto;
|
||||
line-height: 0.86 * 100rpx;
|
||||
text-align: center;
|
||||
color: #fff;
|
||||
border-radius: 0.5 * 100rpx;
|
||||
font-size: 0.3 * 100rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
.payment-top {
|
||||
width: 100%;
|
||||
height: 3.5 * 100rpx;
|
||||
background-color: #eb3729;
|
||||
}
|
||||
.payment-top .name {
|
||||
font-size: 0.26 * 100rpx;
|
||||
color: rgba(255, 255, 255, 0.8);
|
||||
margin-top: -0.38 * 100rpx;
|
||||
margin-bottom: 0.3 * 100rpx;
|
||||
}
|
||||
.payment-top .pic {
|
||||
font-size: 0.32 * 100rpx;
|
||||
color: #fff;
|
||||
}
|
||||
.payment-top .pic-font {
|
||||
font-size: 0.78 * 100rpx;
|
||||
color: #fff;
|
||||
}
|
||||
.picList .pic-box {
|
||||
width: 32%;
|
||||
height: auto;
|
||||
border-radius: 0.2 * 100rpx;
|
||||
margin-top: 0.21 * 100rpx;
|
||||
padding: 0.2 * 100rpx 0;
|
||||
}
|
||||
.pic-box-color {
|
||||
background-color: #f4f4f4;
|
||||
color: #656565;
|
||||
}
|
||||
.pic-number {
|
||||
font-size: 0.22 * 100rpx;
|
||||
}
|
||||
.pic-number-pic {
|
||||
font-size: 0.38 * 100rpx;
|
||||
margin-right: 0.1 * 100rpx;
|
||||
text-align: center;
|
||||
}
|
||||
.pic-box-money {
|
||||
width: 100%;
|
||||
display: block;
|
||||
}
|
||||
#iframe {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.pic-box-color-active {
|
||||
background-color: #eb3729 !important;
|
||||
color: #fff !important;
|
||||
}
|
||||
|
||||
.picList {
|
||||
margin-bottom: 0.3 * 100rpx;
|
||||
margin-top: 0.3 * 100rpx;
|
||||
}
|
||||
|
||||
.font-color {
|
||||
color: #e83323;
|
||||
}
|
||||
|
||||
.recharge {
|
||||
border-radius: 0.1 * 100rpx;
|
||||
width: 100%;
|
||||
background-color: #fff;
|
||||
margin: 0.2 * 100rpx auto 0 auto;
|
||||
padding: 0.3 * 100rpx;
|
||||
border-top-right-radius: 0.39 * 100rpx;
|
||||
border-top-left-radius: 0.39 * 100rpx;
|
||||
margin-top: -0.45 * 100rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.recharge .nav {
|
||||
height: 0.75 * 100rpx;
|
||||
line-height: 0.75 * 100rpx;
|
||||
padding: 0 1 * 100rpx;
|
||||
}
|
||||
|
||||
.recharge .nav .item {
|
||||
font-size: 0.3 * 100rpx;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.recharge .nav .item.on {
|
||||
font-weight: bold;
|
||||
border-bottom: 0.04 * 100rpx solid #e83323;
|
||||
}
|
||||
|
||||
.recharge .info-wrapper {}
|
||||
|
||||
.recharge .info-wrapper .money {
|
||||
margin-top: 0.6 * 100rpx;
|
||||
padding-bottom: 0.2 * 100rpx;
|
||||
border-bottom: 1px dashed #ddd;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.recharge .info-wrapper .money span {
|
||||
font-size: 0.56 * 100rpx;
|
||||
color: #333;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.recharge .info-wrapper .money input {
|
||||
display: inline-block;
|
||||
width: 3 * 100rpx;
|
||||
font-size: 0.84 * 100rpx;
|
||||
text-align: center;
|
||||
color: #282828;
|
||||
font-weight: bold;
|
||||
padding-right: 0.7 * 100rpx;
|
||||
}
|
||||
|
||||
.recharge .info-wrapper .money input::placeholder {
|
||||
color: #ddd;
|
||||
}
|
||||
|
||||
.recharge .info-wrapper .money input::-webkit-input-placeholder {
|
||||
color: #ddd;
|
||||
}
|
||||
|
||||
.recharge .info-wrapper .money input:-moz-placeholder {
|
||||
color: #ddd;
|
||||
}
|
||||
|
||||
.recharge .info-wrapper .money input::-moz-placeholder {
|
||||
color: #ddd;
|
||||
}
|
||||
|
||||
.recharge .info-wrapper .money input:-ms-input-placeholder {
|
||||
color: #ddd;
|
||||
}
|
||||
|
||||
.tip {
|
||||
font-size: 0.28 * 100rpx;
|
||||
color: #333333;
|
||||
font-weight: 800;
|
||||
margin-bottom: 0.14 * 100rpx;
|
||||
}
|
||||
|
||||
.recharge .info-wrapper .tips span {
|
||||
color: #ef4a49;
|
||||
}
|
||||
|
||||
.recharge .info-wrapper .pay-btn {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 0.86 * 100rpx;
|
||||
margin: 0.5 * 100rpx auto 0 auto;
|
||||
line-height: 0.86 * 100rpx;
|
||||
text-align: center;
|
||||
color: #fff;
|
||||
border-radius: 0.5 * 100rpx;
|
||||
font-size: 0.3 * 100rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.payment-top {
|
||||
width: 100%;
|
||||
height: 3.5 * 100rpx;
|
||||
background-color: #eb3729;
|
||||
}
|
||||
|
||||
.payment-top .name {
|
||||
font-size: 0.26 * 100rpx;
|
||||
color: rgba(255, 255, 255, 0.8);
|
||||
margin-top: -0.38 * 100rpx;
|
||||
margin-bottom: 0.3 * 100rpx;
|
||||
}
|
||||
|
||||
.payment-top .pic {
|
||||
font-size: 0.32 * 100rpx;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.payment-top .pic-font {
|
||||
font-size: 0.78 * 100rpx;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.picList .pic-box {
|
||||
width: 32%;
|
||||
height: auto;
|
||||
border-radius: 0.2 * 100rpx;
|
||||
margin-top: 0.21 * 100rpx;
|
||||
padding: 0.2 * 100rpx 0;
|
||||
}
|
||||
|
||||
.pic-box-color {
|
||||
background-color: #f4f4f4;
|
||||
color: #656565;
|
||||
}
|
||||
|
||||
.pic-number {
|
||||
font-size: 0.22 * 100rpx;
|
||||
}
|
||||
|
||||
.pic-number-pic {
|
||||
font-size: 0.38 * 100rpx;
|
||||
margin-right: 0.1 * 100rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.pic-box-money {
|
||||
width: 100%;
|
||||
display: block;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -13,12 +13,7 @@
|
||||
<view class="name">所在地区</view>
|
||||
<view class="picker acea-row row-between-wrapper select-value form-control">
|
||||
<view class="address">
|
||||
<CitySelect
|
||||
ref="cityselect"
|
||||
:defaultValue="addressText"
|
||||
@callback="result"
|
||||
:items="district"
|
||||
></CitySelect>
|
||||
<CitySelect ref="cityselect" :defaultValue="addressText" @callback="result" :items="district"></CitySelect>
|
||||
</view>
|
||||
<view class="iconfont icon-dizhi font-color-red"></view>
|
||||
</view>
|
||||
@ -47,7 +42,7 @@
|
||||
</template>
|
||||
|
||||
<script type="text/babel">
|
||||
import CitySelect from "@/components/CitySelect";
|
||||
import CitySelect from "@/components/CitySelect";
|
||||
import { getAddress, postAddress, getCity } from "@/api/user";
|
||||
import attrs, { required, chs_phone } from "@/utils/validate";
|
||||
import { validatorDefaultCatch } from "@/utils/dialog";
|
||||
@ -89,7 +84,11 @@ export default {
|
||||
that.ready = true;
|
||||
})
|
||||
.catch(err => {
|
||||
that.$dialog.error(err.msg);
|
||||
uni.showToast({
|
||||
title: err.msg,
|
||||
icon: "none",
|
||||
duration: 2000,
|
||||
});
|
||||
});
|
||||
},
|
||||
getUserAddress: function() {
|
||||
@ -194,10 +193,10 @@ export default {
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
.address {
|
||||
text {
|
||||
width: 100%;
|
||||
display: block;
|
||||
.address {
|
||||
text {
|
||||
width: 100%;
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -4,12 +4,7 @@
|
||||
<swiper indicatorDots="true">
|
||||
<block v-for="(item, infoIndex) in info" :key="infoIndex">
|
||||
<swiper-item>
|
||||
<image
|
||||
class="slide-image"
|
||||
:src="item.wap_poster"
|
||||
mode="widthFix"
|
||||
show-menu-by-longpress
|
||||
/>
|
||||
<image class="slide-image" :src="item.wap_poster" mode="widthFix" show-menu-by-longpress />
|
||||
</swiper-item>
|
||||
</block>
|
||||
</swiper>
|
||||
@ -18,143 +13,143 @@
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
// import { swiper, swiperSlide } from "vue-awesome-swiper";
|
||||
import { getSpreadImg } from "@/api/user";
|
||||
// import { swiper, swiperSlide } from "vue-awesome-swiper";
|
||||
import {
|
||||
getSpreadImg
|
||||
} from "@/api/user";
|
||||
|
||||
export default {
|
||||
name: "Poster",
|
||||
components: {
|
||||
// swiper,
|
||||
// swiperSlide
|
||||
},
|
||||
props: {},
|
||||
data: function() {
|
||||
return {
|
||||
swiperPosters: {
|
||||
speed: 1000,
|
||||
effect: "coverflow",
|
||||
slidesPerView: "auto",
|
||||
centeredSlides: true,
|
||||
coverflowEffect: {
|
||||
rotate: 0, // 旋转的角度
|
||||
stretch: -20, // 拉伸 图片间左右的间距和密集度
|
||||
depth: 100, // 深度 切换图片间上下的间距和密集度
|
||||
modifier: 3, // 修正值 该值越大前面的效果越明显
|
||||
slideShadows: false // 页面阴影效果
|
||||
export default {
|
||||
name: "Poster",
|
||||
components: {
|
||||
// swiper,
|
||||
// swiperSlide
|
||||
},
|
||||
props: {},
|
||||
data: function () {
|
||||
return {
|
||||
swiperPosters: {
|
||||
speed: 1000,
|
||||
effect: "coverflow",
|
||||
slidesPerView: "auto",
|
||||
centeredSlides: true,
|
||||
coverflowEffect: {
|
||||
rotate: 0, // 旋转的角度
|
||||
stretch: -20, // 拉伸 图片间左右的间距和密集度
|
||||
depth: 100, // 深度 切换图片间上下的间距和密集度
|
||||
modifier: 3, // 修正值 该值越大前面的效果越明显
|
||||
slideShadows: false // 页面阴影效果
|
||||
},
|
||||
observer: true,
|
||||
observeParents: true
|
||||
},
|
||||
observer: true,
|
||||
observeParents: true
|
||||
},
|
||||
info: [],
|
||||
activeIndex: 0
|
||||
};
|
||||
},
|
||||
mounted: function() {
|
||||
this.getIndex();
|
||||
let that = this;
|
||||
// this.swiper.on("slideChange", function() {
|
||||
// that.activeIndex = that.swiper.activeIndex;
|
||||
// });
|
||||
},
|
||||
computed: {
|
||||
swiper() {
|
||||
// return this.$refs.mySwiper.swiper;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getIndex: function() {
|
||||
info: [],
|
||||
activeIndex: 0
|
||||
};
|
||||
},
|
||||
mounted: function () {
|
||||
this.getIndex();
|
||||
let that = this;
|
||||
let from = {};
|
||||
if (this.$deviceType == "app") {
|
||||
from.from = "app";
|
||||
}
|
||||
getSpreadImg(from).then(
|
||||
res => {
|
||||
that.info = res.data;
|
||||
},
|
||||
err => {
|
||||
uni.showToast({
|
||||
title: err.msg || err.response.data.msg|| err.response.data.message,
|
||||
icon: "none",
|
||||
duration: 2000
|
||||
});
|
||||
}
|
||||
);
|
||||
// this.swiper.on("slideChange", function() {
|
||||
// that.activeIndex = that.swiper.activeIndex;
|
||||
// });
|
||||
},
|
||||
downloadIamge: function(imgsrc, name) {
|
||||
var that = this;
|
||||
this.isDown = true;
|
||||
var downloadUrl = imgsrc;
|
||||
|
||||
if (!wx.saveImageToPhotosAlbum) {
|
||||
uni.showModal({
|
||||
title: "提示",
|
||||
content:
|
||||
"当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。"
|
||||
});
|
||||
that.openDialogVisible = true;
|
||||
|
||||
return;
|
||||
computed: {
|
||||
swiper() {
|
||||
// return this.$refs.mySwiper.swiper;
|
||||
}
|
||||
|
||||
// 可以通过 wx.getSetting 先查询一下用户是否授权了 "scope.writePhotosAlbum" 这个 scope
|
||||
wx.getSetting({
|
||||
success(res) {
|
||||
if (!res.authSetting["scope.writePhotosAlbum"]) {
|
||||
that.openDialogVisible = true;
|
||||
|
||||
// 接口调用询问
|
||||
wx.authorize({
|
||||
scope: "scope.writePhotosAlbum",
|
||||
success() {
|
||||
that.downloadImage(downloadUrl);
|
||||
},
|
||||
fail() {
|
||||
// 用户拒绝了授权
|
||||
// 打开设置页面
|
||||
wx.openSetting({
|
||||
success: function(data) {},
|
||||
fail: function(data) {}
|
||||
});
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getIndex: function () {
|
||||
let that = this;
|
||||
getSpreadImg({
|
||||
from: this.$deviceType == 'weixin' || this.$deviceType == 'weixinh5' ? 'uniappH5' : this.$deviceType
|
||||
}).then(
|
||||
res => {
|
||||
that.info = res.data;
|
||||
},
|
||||
err => {
|
||||
uni.showToast({
|
||||
title: err.msg || err.response.data.msg || err.response.data.message,
|
||||
icon: "none",
|
||||
duration: 2000
|
||||
});
|
||||
} else {
|
||||
that.downloadImage(downloadUrl);
|
||||
}
|
||||
},
|
||||
fail(res) {
|
||||
);
|
||||
},
|
||||
downloadIamge: function (imgsrc, name) {
|
||||
var that = this;
|
||||
this.isDown = true;
|
||||
var downloadUrl = imgsrc;
|
||||
|
||||
if (!wx.saveImageToPhotosAlbum) {
|
||||
uni.showModal({
|
||||
title: "提示",
|
||||
content: "当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。"
|
||||
});
|
||||
that.openDialogVisible = true;
|
||||
|
||||
return;
|
||||
}
|
||||
});
|
||||
},
|
||||
saveImg: function() {
|
||||
this.downloadIamge(
|
||||
this.info[this.activeIndex].wap_poster,
|
||||
"poster" + this.activeIndex
|
||||
);
|
||||
|
||||
// 可以通过 wx.getSetting 先查询一下用户是否授权了 "scope.writePhotosAlbum" 这个 scope
|
||||
wx.getSetting({
|
||||
success(res) {
|
||||
if (!res.authSetting["scope.writePhotosAlbum"]) {
|
||||
that.openDialogVisible = true;
|
||||
|
||||
// 接口调用询问
|
||||
wx.authorize({
|
||||
scope: "scope.writePhotosAlbum",
|
||||
success() {
|
||||
that.downloadImage(downloadUrl);
|
||||
},
|
||||
fail() {
|
||||
// 用户拒绝了授权
|
||||
// 打开设置页面
|
||||
wx.openSetting({
|
||||
success: function (data) {},
|
||||
fail: function (data) {}
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
that.downloadImage(downloadUrl);
|
||||
}
|
||||
},
|
||||
fail(res) {
|
||||
that.openDialogVisible = true;
|
||||
}
|
||||
});
|
||||
},
|
||||
saveImg: function () {
|
||||
this.downloadIamge(
|
||||
this.info[this.activeIndex].wap_poster,
|
||||
"poster" + this.activeIndex
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
page {
|
||||
height: 100%;
|
||||
}
|
||||
.distribution-posters {
|
||||
height: 100%;
|
||||
}
|
||||
<style lang="less">
|
||||
page {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.banenr {
|
||||
height: 100%;
|
||||
}
|
||||
.distribution-posters {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.banner swiper {
|
||||
height: 100%;
|
||||
}
|
||||
.banenr {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.banner .slide-image {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
.banner swiper {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.banner .slide-image {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user