From fe75cffbf3bae6777aa2794fd89fa5dc37f5df8d Mon Sep 17 00:00:00 2001 From: gaoluyang <2820782392@qq.com> Date: 星期二, 15 七月 2025 10:11:23 +0800 Subject: [PATCH] 项目初始化 --- src/pages_geek/pages/code/index.vue | 130 +++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 130 insertions(+), 0 deletions(-) diff --git a/src/pages_geek/pages/code/index.vue b/src/pages_geek/pages/code/index.vue new file mode 100644 index 0000000..353ec3a --- /dev/null +++ b/src/pages_geek/pages/code/index.vue @@ -0,0 +1,130 @@ +<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: '' // 浜岀淮鐮佺敓鎴愬悗鐨勫浘鐗囧湴鍧�鎴朾ase64 + } + }, + 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> -- Gitblit v1.9.3