¶Ô±ÈÐÂÎļþ |
| | |
| | | <template xlang="wxml"> |
| | | <view class="container"> |
| | | <view class="qrimg"> |
| | | <view class="qrimg-i"> |
| | | <geek-qrcode v-if="ifShow" cid="qrcode1" ref="qrcode" :val="val" :size="size" :unit="unit" |
| | | :background="background" :foreground="foreground" :pdground="pdground" :icon="icon" :iconSize="iconsize" |
| | | :lv="lv" :onval="onval" :loadMake="loadMake" :usingComponents="true" @result="qrR" /> |
| | | </view> |
| | | <view class="qrimg-i"> |
| | | <geek-qrcode v-if="ifShow" cid="qrcode2" ref="qrcode2" val="第äºä¸ªäºç»´ç " :size="size" :onval="onval" |
| | | :loadMake="loadMake" :usingComponents="true" @result="qrR" /> |
| | | </view> |
| | | </view> |
| | | <view class="uni-padding-wrap"> |
| | | <view class="uni-title">请è¾å
¥è¦çæçäºç»´ç å
容</view> |
| | | </view> |
| | | <view class="uni-list"> |
| | | <input class="uni-input" placeholder="请è¾å
¥è¦çæçäºç»´ç å
容" v-model="val" /> |
| | | </view> |
| | | <view class="uni-padding-wrap uni-common-mt"> |
| | | <view class="uni-title">设置äºç»´ç 大å°</view> |
| | | </view> |
| | | <view class="body-view"> |
| | | <slider :value="size" @change="sliderchange" min="50" max="500" show-value /> |
| | | </view> |
| | | <view class="uni-padding-wrap"> |
| | | <view class="btns"> |
| | | <button type="primary" @tap="selectIcon">éæ©äºç»´ç 徿 </button> |
| | | <button type="primary" @tap="creatQrcode">çæäºç»´ç </button> |
| | | <button type="primary" @tap="saveQrcode">ä¿åå°å¾åº</button> |
| | | <button type="warn" @tap="clearQrcode">æ¸
é¤äºç»´ç </button> |
| | | <button type="warn" @tap="ifQrcode">æ¾ç¤ºéèäºç»´ç </button> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </template> |
| | | <script> |
| | | export default { |
| | | data() { |
| | | return { |
| | | ifShow: true, |
| | | val: 'äºç»´ç ', // è¦çæçäºç»´ç å¼ |
| | | size: 200, // äºç»´ç å¤§å° |
| | | unit: 'upx', // åä½ |
| | | background: '#b4e9e2', // èæ¯è² |
| | | foreground: '#309286', // åæ¯è² |
| | | pdground: '#32dbc6', // è§æ è² |
| | | icon: '', // äºç»´ç 徿 |
| | | iconsize: 40, // äºç»´ç 徿 å¤§å° |
| | | lv: 3, // äºç»´ç 容éçº§å« ï¼ ä¸è¬ä¸ç¨è®¾ç½®ï¼é»è®¤å°±è¡ |
| | | onval: false, // valå¼ååæ¶èªå¨éæ°çæäºç»´ç |
| | | loadMake: true, // ç»ä»¶å è½½å®æåèªå¨çæäºç»´ç |
| | | src: '' // äºç»´ç çæåçå¾çå°åæbase64 |
| | | } |
| | | }, |
| | | methods: { |
| | | sliderchange(e) { |
| | | this.size = e.detail.value |
| | | }, |
| | | creatQrcode() { |
| | | this.$refs.qrcode._makeCode() |
| | | }, |
| | | saveQrcode() { |
| | | this.$refs.qrcode._saveCode() |
| | | }, |
| | | qrR(res) { |
| | | this.src = res |
| | | }, |
| | | clearQrcode() { |
| | | this.$refs.qrcode._clearCode() |
| | | this.val = '' |
| | | }, |
| | | ifQrcode() { |
| | | this.ifShow = !this.ifShow |
| | | }, |
| | | selectIcon() { |
| | | let that = this |
| | | uni.chooseImage({ |
| | | count: 1, //é»è®¤9 |
| | | sizeType: ['original', 'compressed'], //å¯ä»¥æå®æ¯åå¾è¿æ¯å缩å¾ï¼é»è®¤äºè
齿 |
| | | sourceType: ['album'], //ä»ç¸åéæ© |
| | | success: function (res) { |
| | | that.icon = res.tempFilePaths[0] |
| | | setTimeout(() => { |
| | | that.creatQrcode() |
| | | }, 100); |
| | | // console.log(res.tempFilePaths); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style> |
| | | /* @import "../../../common/icon.css"; */ |
| | | .container { |
| | | display: flex; |
| | | flex-direction: column; |
| | | width: 100%; |
| | | } |
| | | |
| | | .qrimg { |
| | | display: flex; |
| | | justify-content: center; |
| | | } |
| | | |
| | | .qrimg-i { |
| | | margin-right: 10px; |
| | | } |
| | | |
| | | slider { |
| | | width: 100%; |
| | | } |
| | | |
| | | input { |
| | | width: 100%; |
| | | margin-bottom: 20upx; |
| | | } |
| | | |
| | | .btns { |
| | | display: flex; |
| | | flex-direction: column; |
| | | width: 100%; |
| | | } |
| | | |
| | | button { |
| | | width: 100%; |
| | | margin-top: 10upx; |
| | | }</style> |