修改二维码

This commit is contained in:
2024-04-25 08:51:18 +08:00
parent ff36356543
commit 994d6155a2
7 changed files with 87 additions and 30 deletions

View File

@@ -11,16 +11,19 @@ Page({
* 页面的初始数据
*/
data: {
list: [],
urls: [],
indexs: [],
// list: [],
// urls: [],
// indexs: [],
url: "",
tenement: wx.getStorageSync('tenement')
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.getList()
// this.getList()
this.getCode()
},
async getList() {
const { code, message, data } = await getOwnTenementList()
@@ -38,20 +41,24 @@ Page({
})
},
async getCode(e, that) {
const { index, id } = e.currentTarget.dataset;
const { code, message, data } = await getWxCode(id)
// const { index, id } = e.currentTarget.dataset;
const tenement = this.data.tenement;
const { code, message, data } = await getWxCode(tenement.id)
if (code !== OK) {
alertInfo(message)
return;
}
const newUrls = that.data.urls;
newUrls[index] = data;
const newIndexs = that.data.indexs;
newIndexs[index] = true;
that.setData({
urls: newUrls,
indexs: newIndexs,
this.setData({
url: data
})
// const newUrls = that.data.urls;
// newUrls[index] = data;
// const newIndexs = that.data.indexs;
// newIndexs[index] = true;
// that.setData({
// urls: newUrls,
// indexs: newIndexs,
// })
},
look(e) {
const that = this;

View File

@@ -1,12 +1,18 @@
<!--pages/qrCode/index.wxml-->
<view class="wrapper">
<!-- <view class="wrapper">
<view class="item" wx:for="{{list}}" wx:key="index">
<view class="tenement" >
<view class="name">{{item.name}}</view>
<view class="primaryTextBtn" data-index="{{index}}" data-id="{{item.id}}" bind:tap="look"> 查看二维码 </view>
</view>
<view class="image" wx:if="{{indexs[index] == true}}">
<van-image width="400rpx" height="400rpx" src="{{urls[index]}}" />
</view>
</view>
</view>
</view> -->
<view class="wrapper">
<view class="image">
<van-image width="400rpx" height="400rpx" src="{{url}}" />
</view>
<view style="padding-bottom: 100rpx;margin-left: 40rpx;margin-right: 40rpx;"> 扫描该二维码可进入{{tenement.name}} </view>
</view>

View File

@@ -1,12 +1,11 @@
/* pages/qrCode/index.wxss */
.wrapper {
/* width: 100vw;
width: 100vw;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column; */
/* margin-top: 20rpx; */
flex-direction: column;
margin-left: 32rpx;
margin-right: 32rpx;
}