优化页面,适配微信小程序

This commit is contained in:
TOP糯米 2023-02-14 23:21:11 +08:00
parent 7a80e64e7f
commit 56e06b2adc
5 changed files with 44 additions and 16 deletions

View File

@ -66,7 +66,11 @@
"scope.userLocation" : { "scope.userLocation" : {
"desc" : "请求获取您的位置信息" "desc" : "请求获取您的位置信息"
} }
} },
"requiredPrivateInfos": [
"chooseAddress",
"chooseLocation"
]
}, },
"mp-alipay" : { "mp-alipay" : {
"usingComponents" : true "usingComponents" : true

View File

@ -11,7 +11,11 @@
v-for="(item, index) in list" v-for="(item, index) in list"
:key="index" :key="index"
> >
<view class="address-box" @click="selectAddress(item)"> <view
class="address-box"
@click="selectAddress(item)"
@longpress="deleteAddress(item.id, index)"
>
<view class="checkbox"> <view class="checkbox">
<widget-check-box <widget-check-box
:size="52" :size="52"
@ -67,7 +71,7 @@ export default {
id: 1, id: 1,
isDefault: false, isDefault: false,
address: "四川省绵阳市高新区", address: "四川省绵阳市高新区",
detail: "火炬东110号", detail: "火炬东110号",
name: "李(先生)", name: "李(先生)",
mobile: "18200000001", mobile: "18200000001",
}, },
@ -75,7 +79,7 @@ export default {
id: 2, id: 2,
isDefault: false, isDefault: false,
address: "四川省绵阳市高新区", address: "四川省绵阳市高新区",
detail: "火炬东110号", detail: "火炬东110号",
name: "李(先生)", name: "李(先生)",
mobile: "18200000001", mobile: "18200000001",
}, },
@ -83,7 +87,7 @@ export default {
id: 3, id: 3,
isDefault: true, isDefault: true,
address: "四川省绵阳市高新区", address: "四川省绵阳市高新区",
detail: "火炬东110号", detail: "火炬东110号",
name: "李(先生)", name: "李(先生)",
mobile: "18200000001", mobile: "18200000001",
}, },
@ -121,15 +125,21 @@ export default {
} }
}, },
getWechatAddress() { getWechatAddress() {
console.log("获取微信地址"); // #ifndef H5
let wechatAddress = {};
uni.chooseAddress({ uni.chooseAddress({
success: (d) => { success: (data) => {
console.log(d); wechatAddress.address =
}, data.provinceName + data.cityName + data.countyName;
fail: (error) => { wechatAddress.detail = data.detailInfo;
console.log(error); wechatAddress.mobile = data.telNumber;
}, wechatAddress.name = data.userName;
wechatAddress.gender = 1;
wechatAddress.isDefault = false;
console.log(wechatAddress);
}
}); });
// #endif
}, },
addAddress() { addAddress() {
uni.navigateTo({ uni.navigateTo({
@ -141,6 +151,17 @@ export default {
url: "/pages/address/edit?id=" + id, url: "/pages/address/edit?id=" + id,
}); });
}, },
deleteAddress(id, index) {
uni.showModal({
title: "删除地址?",
content: "数据删除后不可恢复,请谨慎操作!",
complete: (res) => {
if (res.confirm) {
this.list.splice(index, 1);
}
},
});
},
}, },
}; };
</script> </script>
@ -149,7 +170,7 @@ export default {
.address-group { .address-group {
width: 100%; width: 100%;
box-sizing: border-box; box-sizing: border-box;
padding: 0 18rpx; padding: 0 18rpx 120rpx 18rpx;
.address-item { .address-item {
display: flex; display: flex;
align-items: center; align-items: center;
@ -239,7 +260,7 @@ export default {
} }
} }
.btn.add-address { .btn.add-address {
background: rgba(139, 155, 235, 0); background: #f6f6f6;
border: 1px solid #4b65ed; border: 1px solid #4b65ed;
box-sizing: border-box; box-sizing: border-box;
.text { .text {

View File

@ -200,6 +200,8 @@ export default {
} }
.input-box.map { .input-box.map {
.address-text { .address-text {
z-index: 10;
position: relative;
font-size: 28rpx; font-size: 28rpx;
color: #c9c9c9; color: #c9c9c9;
box-sizing: border-box; box-sizing: border-box;

View File

@ -176,6 +176,7 @@ export default {
.form-container { .form-container {
width: 100%; width: 100%;
margin-top: 16rpx; margin-top: 16rpx;
padding-bottom: 120rpx;
} }
.select-group { .select-group {
width: 100%; width: 100%;

View File

@ -128,7 +128,7 @@ export default {
require("@/static/temp/cate/5.png"), require("@/static/temp/cate/5.png"),
require("@/static/temp/cate/5.png"), require("@/static/temp/cate/5.png"),
], ],
content: "<p>这是服务内容</p>", content: "<p>这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容这是服务内容</p>",
}, },
}; };
}, },
@ -288,7 +288,7 @@ export default {
} }
} }
.service-section.detail-box { .service-section.detail-box {
padding-bottom: 205rpx; padding-bottom: 100rpx;
.detail { .detail {
position: relative; position: relative;
width: 670rpx; width: 670rpx;