加入用户二维码功能

This commit is contained in:
Your Name 2023-05-30 02:29:30 +08:00
parent b9556ec973
commit e277ff6875
6 changed files with 162 additions and 45 deletions

View File

@ -217,5 +217,31 @@ export function queryDict(_objData){
}) })
} }
/**
* 查询活动列表
*/
export function generatorUserQrCode( _that) {
let obj = {
tel: '123'
};
return new Promise(
(resolve, reject) => {
request({
url: url.generatorUserQrCode,
method: "POST",
data: obj,
//动态数据
success: function(res) {
uni.hideLoading();
resolve(res.data);
},
fail: function(e) {
uni.hideLoading();
reject();
}
});
})
}

View File

@ -9,7 +9,9 @@
<text class="username">{{ userName }}</text> <text class="username">{{ userName }}</text>
<text class="userphone">{{ userPhone }}</text> <text class="userphone">{{ userPhone }}</text>
<text class="userarea" @tap="_changeCommunity()">{{ communityName }} <text class="cuIcon-settings text-white margin-left-sm"></text></text> <text class="userarea" @tap="_changeCommunity()">{{ communityName }} <text class="cuIcon-settings text-white margin-left-sm"></text></text>
</view>
<view class="text-right" @click="_viewUserQrCode">
<text class="cuIcon-qrcode text-white margin-left" ></text>
</view> </view>
</view> </view>
<view class="wait" v-else @tap="showLongModel"> <view class="wait" v-else @tap="showLongModel">
@ -218,6 +220,11 @@
url: '/pages/coupon/myCoupons', url: '/pages/coupon/myCoupons',
}) })
}, },
_viewUserQrCode:function(){
this.vc.navigateTo({
url:'/pages/my/userQrCode'
})
}
} }
} }
@ -285,4 +292,8 @@
background: #eee; background: #eee;
} }
} }
.cuIcon-qrcode{
font-size: 48upx;
}
</style> </style>

View File

@ -207,7 +207,7 @@ export default {
listCommunityPublicity: baseUrl + "app/publicity.listCommunityPublicity", listCommunityPublicity: baseUrl + "app/publicity.listCommunityPublicity",
listChargeMonthOrder: baseUrl + "app/chargeCard.listChargeMonthOrder", listChargeMonthOrder: baseUrl + "app/chargeCard.listChargeMonthOrder",
listChargeMonthCard: baseUrl + "app/chargeCard.listChargeMonthCard", listChargeMonthCard: baseUrl + "app/chargeCard.listChargeMonthCard",
generatorUserQrCode: baseUrl + "app/user.generatorUserQrCode",
NEED_NOT_LOGIN_PAGE: [ NEED_NOT_LOGIN_PAGE: [
'pages/login/login', 'pages/login/login',

View File

@ -898,6 +898,15 @@
} }
} }
,{
"path" : "pages/my/userQrCode",
"style" :
{
"navigationBarTitleText": "用户二维码",
"enablePullDownRefresh": false
}
}
], ],
"tabBar": { "tabBar": {
"color": "#272636", "color": "#272636",

View File

@ -60,8 +60,8 @@
data() { data() {
return { return {
logoUrl: '', logoUrl: '',
username: '', username: '17797171234',
password: '', password: '123456',
appId: "", appId: "",
code: "", code: "",
loginByPhone: false, loginByPhone: false,

71
pages/my/userQrCode.vue Normal file
View File

@ -0,0 +1,71 @@
<template>
<view>
<view class="padding-xl margin-top">
<canvas style="width: 520upx;height: 520upx; margin: 0 auto;" canvas-id="userQrcode"></canvas>
</view>
<view class="padding text-center">
二维码有效期为5分钟
</view>
</view>
</template>
<script>
const qrCode = require('@/lib/weapp-qrcode.js')
import {generatorUserQrCode} from '../../api/user/userApi.js'
export default {
data() {
return {
qrCode:''
}
},
onLoad(options){
this.vc.onLoad(options);
this._generatorQrCode();
},
methods: {
_generatorQrCode:function(){
let _that = this;
//
generatorUserQrCode(this).then((res)=>{
let data = res;
let msg = '';
if(data.code != 0){
wx.showToast({
title: data.msg,
icon: 'none',
duration: 2000
});
return ;
}
_that.qrCode = data.data
new qrCode('userQrcode', {
text: _that.qrCode?_that.qrCode:'生成二维码失败',
width: 250,
height: 250,
colorDark: "#333333",
colorLight: "#FFFFFF",
correctLevel: qrCode.CorrectLevel.L
})
},(err)=>{
wx.hideLoading();
wx.showToast({
title: err,
icon: 'none',
duration: 2000
});
})
},
_closeModal:function(){
uni.navigateBack({
delta:1
})
}
}
}
</script>
<style>
</style>