国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

uniapp+uView 實(shí)現(xiàn)自定義水印相機(jī),拍完照片給圖片加水印,從相冊(cè)選擇圖片加水印功能

這篇具有很好參考價(jià)值的文章主要介紹了uniapp+uView 實(shí)現(xiàn)自定義水印相機(jī),拍完照片給圖片加水印,從相冊(cè)選擇圖片加水印功能。希望對(duì)大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請(qǐng)大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問(wèn)。

uniapp實(shí)現(xiàn)拍照加水印,數(shù)碼相機(jī),uni-appuniapp實(shí)現(xiàn)拍照加水印,數(shù)碼相機(jī),uni-appuniapp實(shí)現(xiàn)拍照加水印,數(shù)碼相機(jī),uni-app

樣式圖如上所示


頁(yè)面分為取景框和拍照完成后預(yù)覽,本功能設(shè)計(jì)到,公共上傳組件,相機(jī)也頁(yè)面,獲取定位地址,頁(yè)面中如何用該上傳組件

UI實(shí)現(xiàn)
取景界面分為上下兩個(gè)部分,上部分為camera取景框組件,下部分為操作區(qū)域。

取景框組件上的關(guān)閉和水印,以及拍完照片后的略縮圖展示需要通過(guò)cover-view和cover-image來(lái)展示。

頁(yè)面中的引用

 <my-camera :maxCount="5" :name="1" :editUrl="fileList1" @filesSelected="handleFilesSelected"  @upload="handleUpload" />
   import myCamera from '@/components/camera/index.vue'
 components: {
      myCamera,
    },
     data() {
      return {
        fileList1: [],
        
        }
      }
      //刪除圖片
      handleFilesSelected(index, name) {
        this[`fileList${name}`].splice(index, 1);
      },
      //圖片上傳
      handleUpload(data) {
        this[`fileList${data.name}`] = data.fileList
      }


結(jié)構(gòu)代碼如下:
?

<view class="u-upload">
    <view class="u-list-item u-preview-wrap" v-for="(item, index) in fileList" :key="index" :style="{
			width: 150,
			height: 150
		}">
      <view class="u-delete-icon" @click="deleteItem(index)" :style="{
					background: '#000'
				}">
        <u-icon class="u-icon" name="close" size="10" color="#ffffff"></u-icon>
      </view>
      <image @click="lookImg(index)" class="u-preview-image" :src="item.url"></image>
      <view class="u-upload__status" v-if="item.status === 'uploading'">
        <view class="u-upload__status__icon">
          <u-icon v-if="item.status === 'failed'" name="close-circle" color="#ffffff" size="25" />
          <u-loading-icon size="22" mode="circle" color="#ffffff" v-else />
        </view>
        <text v-if="item.message" class="u-upload__status__message">{{ item.message }}</text>
      </view>
    </view>
    <view style="display: inline-block;" @click="gotoCamera" v-if="fileList.length < maxCount">
      <slot name="addBtn"></slot>
      <view class="u-list-item u-add-wrap" hover-class="u-add-wrap__hover" hover-stay-time="150" :style="{
					width: 150,
					height: 150
				}">
        <u-icon name="camera" size="30"></u-icon>
      </view>
    </view>
    <u-popup :show="show" mode="bottom" @close="close">
      <view style="height: 260rpx;">
        <view class="popup_item" @click="goCamera()">拍照</view>
        <view class="popup_item" @click="goAlbum()">相冊(cè)</view>
      </view>
    </u-popup>
    <view style="position: absolute;top: -999999px;">
      <view><canvas :style="{ width: w, height: h }" canvas-id="firstCanvas"></canvas></view>
    </view>
  </view>

?樣式css

<style scoped lang="scss">
  .u-upload {
    // @include vue-flex;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
  }

  .u-add-tips {
    margin-top: 20rpx;
    line-height: 40rpx;
  }

  .u-delete-icon {
    position: absolute;
    top: 4rpx;
    right: 4rpx;
    z-index: 10;
    background-color: red;
    border-radius: 100rpx;
    width: 32rpx;
    height: 32rpx;
    // @include vue-flex;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .u-icon {
    // @include vue-flex;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .u-list-item {
    width: 160rpx;
    height: 160rpx;
    overflow: hidden;
    margin: 10rpx;
    background: rgb(244, 245, 246);
    position: relative;
    border-radius: 10rpx;
    /* #ifndef APP-NVUE */
    display: flex;
    /* #endif */
    align-items: center;
    justify-content: center;
  }

  .u-preview-wrap {
    border: 1px solid rgb(235, 236, 238);
  }

  .u-preview-image {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 10rpx;
  }

  .popup_item {
    width: 100%;
    height: 130rpx;
    text-align: center;
    line-height: 130rpx;
    border-bottom: 1px solid #eaeef1;
  }

  .u-upload__status {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: rgba(0, 0, 0, 0.5);
    @include flex(column);
    align-items: center;
    justify-content: center;
  }

  .u-upload__status__icon {
    position: relative;
    z-index: 1;
  }

  .u-upload__status__message {
    font-size: 12px;
    color: #FFFFFF;
    margin-top: 5px;
  }
</style>

公共上傳組件數(shù)據(jù)的綁定

 import {
    props
  } from '../../uni_modules/uview-ui/libs/mixin/mixin';
  import getCurrentLngAndLat from "@/utils/getAddressLocation.js"
  export default {
    name: "myCamera",
    props: {
      maxCount: {
        type: Number,
        default: 1
      },
      name: {
        type: String,
        required: true
      },
      editUrl: {
        type: Array,
        default: () => {
          []
        }
      },
      type: {
        type: String,
        default: () => 'order'
      },
      customStyle: {
        type: Object,
        default: () => {}
      }
    },
    data() {
      return {
        fileList: [],
        show: false,
        w: '',
        h: '',
        nowTime: '', //日期
        nowTime2: '', //時(shí)間
        nowWeek: '', // 周幾
        address: '', //當(dāng)前地址信息
      }
    },

公共組件部分js實(shí)現(xiàn):分為拍照與相冊(cè)中上傳,包括刪除圖片,預(yù)覽圖片,保存圖片到相冊(cè)

 watch: {
      editUrl: {
        immediate: true,
        handler(newVal, oldVal) {
          if (this.editUrl[0]?.url === '' || this.editUrl[0]?.url === null) {
            this.fileList = [];
          } else {
            this.fileList = this.editUrl
          }
        }
      }
    },
    methods: {
      goCamera() {
        uni.$u.route(`/pages/camera/camera?name=${this.name}`);
        this.close();
      },
      async goAlbum() {
        this.close();
        this.getTime();
        const res1 = await getCurrentLngAndLat();
        this.address = res1.currentSignAddress;
        const res = await this.chooseFile();
        this.afterRead(res)
      },
      //選擇圖片
      chooseFile() {
        return new Promise((resolve, reject) => {
          uni.chooseImage({
            count: this.maxCount ? this.maxCount : 1, //默認(rèn)9
            sizeType: ['original', 'compressed'], //可以指定是原圖還是壓縮圖,默認(rèn)二者都有
            sourceType: ['album'], //從相冊(cè)選擇
            success: res => resolve(this.formatImage(res)),
          });
        })
      },
      //處理圖片
      formatImage(res) {
        return res.tempFiles.map(item => ({
          ...this.pickExclude(item, ['path']),
          type: 'image',
          url: item.path,
          thumb: item.path,
          size: item.size,
        }))
      },
      pickExclude(obj, keys) {
        // 某些情況下,type可能會(huì)為
        if (!['[object Object]', '[object File]'].includes(Object.prototype.toString.call(obj))) {
          return {}
        }
        return Object.keys(obj).reduce((prev, key) => {
          if (!keys.includes(key)) {
            prev[key] = obj[key]
          }
          return prev
        }, {})
      },
      close() {
        this.show = false;
      },
      // 跳轉(zhuǎn)到拍照頁(yè)面
      gotoCamera() {
        this.show = true;
      },
      async afterRead(file) {
        const lists = [].concat(file);
        const fileListLen = this.fileList.length;
        for (let i = 0; i < lists.length; i++) {
          const item = lists[i];
          let waterUrl = await this.addWatermark(item.url);
          this.fileList.push({
            ...item,
            status: "uploading",
            message: "上傳中"
          });
          try {
            const result = await this.uploadFilePromise(waterUrl);
            const uploadedItem = Object.assign({}, item, {
              status: "success",
              message: "",
              url: result
            });
            this.fileList.splice(fileListLen + i, 1, uploadedItem);
          } catch (error) {
            const failedItem = Object.assign({}, item, {
              status: "fail",
              message: "上傳失敗"
            });
            this.fileList.splice(fileListLen + i, 1, failedItem);
          }
        }
        this.$emit("upload", {
          name: this.name,
          fileList: this.fileList
        });
      },
      //上傳圖片
      uploadFilePromise(url) {
        let host = "";
        // #ifndef H5
        let envVs = uni.getAccountInfoSync().miniProgram.envVersion;
        if (envVs === 'release') {
          host = uni.getStorageSync('normal_url')
        } else if (envVs === 'trial') {
          host = uni.getStorageSync('exp_url')
        } else if (envVs === 'develop') {
          host = uni.getStorageSync('test_url')
        }
        // #endif
        return new Promise((resolve, reject) => {
          uni.uploadFile({
            url: host + '上傳圖片接口的url', // 僅為示例,非真實(shí)的接口地址
            filePath: url,
            name: 'file',
            formData: {
              type: 'order',
              lat: 23.129163,
              lng: 113.264435
            },
            header: {
              Authorization: 'Bearer ' + uni.getStorageSync('token')
            },
            success: (res) => {
              setTimeout(() => {
                let arr = JSON.parse(res.data)
                resolve(arr.data?.url)
              }, 1000)
            },
          })
        })
      },
      // 刪除圖片
      deleteItem(index) {
        let that = this;
        uni.showModal({
          title: '提示',
          content: '您確定要?jiǎng)h除此張照片嗎?',
          success: async (res) => {
            if (res.confirm) {
              this.$emit("filesSelected", index, this.name);
            }
          }
        });
      },
      //查看圖片
      lookImg(index) {
        let photoList = this.editUrl.map(item => {
          return item.url;
        });
        // 預(yù)覽圖片
        uni.previewImage({
          current: index,
          urls: photoList,
        });
      },
      //添加水印
      async addWatermark(img) {
        var that = this
        let res1 = await new Promise((resolve, reject) => {
          uni.getImageInfo({
            src: img,
            success: (res) => {
              that.w = res.width / 3 + 'px';
              that.h = res.height / 3.01 + 'px';
              let ctx = uni.createCanvasContext('firstCanvas', this); /** 創(chuàng)建畫(huà)布 */
              //將圖片src放到cancas內(nèi),寬高為圖片大小
              ctx.drawImage(img, 0, 0, res.width / 3, res.height / 3);
              // ctx.setFontSize(18);
              ctx.setFontSize(Math.floor(res.width * 0.04));
              ctx.setFillStyle('#fff');
              ctx.setTextAlign('center');
              let textToWidth = (res.width / 3) * 0.5;
              let textToHeight = (res.height / 3) * 0.86;
              ctx.fillText(that.nowTime2, textToWidth, textToHeight);
              ctx.setFontSize(Math.floor(res.width * 0.015));
              let textToHeight2 = (res.height / 3) * 0.91;
              ctx.fillText(that.nowTime + ' ' + that.nowWeek, textToWidth, textToHeight2);
              ctx.setFontSize(Math.floor(res.width * 0.01));
              let textToHeight3 = (res.height / 3) * 0.95;
              ctx.fillText(' ?? ' + that.address, textToWidth, textToHeight3);
              ctx.draw(false, () => {
                // 將畫(huà)布轉(zhuǎn)化為圖片
                uni.canvasToTempFilePath({
                  canvasId: 'firstCanvas',
                  success: (res) => {
                    resolve(res.tempFilePath);
                  },
                  fail: (err) => {
                    reject(err);
                  }
                }, this);
              });
            }
          });
        });
        return (res1);
      },
       //獲取時(shí)間
      getTime: function() {
        var weekarr = new Array("日", "一", "二", "三", "四", "五", "六");
        var date = new Date(),
          year = date.getFullYear(),
          month = date.getMonth() + 1,
          day = date.getDate(),
          hour = date.getHours() < 10 ? "0" + date.getHours() : date.getHours(),
          minute = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes(),
          second = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
        month >= 1 && month <= 9 ? (month = "0" + month) : "";
        day >= 0 && day <= 9 ? (day = "0" + day) : "";
        var timer = year + '-' + month + '-' + day;
        var timer3 = hour + ':' + minute + ':' + second;
        var timer2 = hour + ':' + minute
        this.nowTime = timer;
        this.nowTime2 = timer2;
        this.nowTime3 = timer3;
        this.nowWeek = '星期' + weekarr[date.getDay()];
      },

    }
  

相機(jī)頁(yè)面的全部代碼:(相機(jī)頁(yè)面給圖片加水印與選擇圖片加水印可以抽離出一個(gè)公共的方法,時(shí)間緊任務(wù)重我就沒(méi)。。。)

<template>
  <view>
    <camera :device-position="device" :flash="flash" @error="error"
      :style="{ width: '100%',position: 'relative', height: getHeight + 'px' }">
      <cover-view class="topBox">
        <cover-view class="topItem">{{nowWeek}}</cover-view>
        <cover-view class="topItem">{{nowTime +' '+nowTime2}}</cover-view>
        <cover-view class="topItem">{{address}}</cover-view>
      </cover-view>
      <cover-image @click="xzBtn" class="xzImg" src="https://cdn.zhoukaiwen.com/xz.png"></cover-image>
      <cover-view class="cameraBtn" @click="takePhoto">
        <cover-view class="cameraBtn2"></cover-view>
      </cover-view>
    </camera>
    <view style="position: absolute;top: -999999px;">
      <view><canvas :style="{ width: w, height: h }" canvas-id="firstCanvas"></canvas></view>
    </view>
  </view>
</template>

<script>
  import getCurrentLngAndLat from "@/utils/getAddressLocation.js"
  export default {
    data() {
      return {
        getHeight: '200',
        device: 'back', //前置或后置攝像頭,值為front, back
        flash: 'off', //閃光燈,值為auto, on, off
        nowTime: '', //日期
        nowTime2: '', //時(shí)間
        nowWeek: '', // 周幾
        address: '', //當(dāng)前地址信息
        city: '',
        district: '',
        name: '',
        imgList: [],
        imgListData: '',
        rreportShow: false, //選擇照片備注內(nèi)容彈窗
        src: '',
        w: '',
        h: ''
      }
    },
    async onLoad(options) {
      const that = this;
      uni.getSystemInfo({
        success: function(res) {
          that.getHeight = res.windowHeight;
        }
      });
      this.getTime();
      const res = await getCurrentLngAndLat();
      this.address = res.currentSignAddress;
      this.name = +options.name
    },
    methods: {
      xzBtn() {
        if (this.device == 'front') {
          this.device = 'back'
        } else {
          this.device = 'front'
        }
      },
      // 點(diǎn)擊拍照
      takePhoto() {
        var that = this;
        if (this.imgList.length < 3) {
          const ctx = uni.createCameraContext();
          ctx.takePhoto({
            quality: 'high',
            success: (ress) => {
              var tempImagePath = ress.tempImagePath;
              // 獲取圖片信息
              uni.getImageInfo({
                src: ress.tempImagePath,
                success: res => {
                  that.w = res.width / 3 + 'px';
                  that.h = res.height / 3.01 + 'px';
                  let ctx = uni.createCanvasContext('firstCanvas'); /** 創(chuàng)建畫(huà)布 */
                  //將圖片src放到cancas內(nèi),寬高為圖片大小
                  ctx.drawImage(ress.tempImagePath, 0, 0, res.width / 3, res.height / 3);
                  ctx.setFontSize(18);
                  ctx.setFillStyle('#FFFFFF');
                  ctx.setTextAlign('center');
                  // 		// ctx.rotate(30 * Math.PI / 180);//0.03
                  let textToWidth = (res.width / 3) * 0.5;
                  let textToHeight = (res.height / 3) * 0.9;
                  ctx.fillText(that.nowTime2, textToWidth, textToHeight);
                  ctx.setFontSize(12);
                  let textToHeight2 = (res.height / 3) * 0.94;
                  ctx.fillText(that.nowTime + ' ' + that.nowWeek, textToWidth, textToHeight2);
                  ctx.setFontSize(7);
                  let textToHeight3 = (res.height / 3) * 0.98;
                  ctx.fillText(' ?? ' + that.address, textToWidth, textToHeight3);
                  ctx.draw(false, () => {
                    setTimeout(() => {
                      uni.canvasToTempFilePath({
                        canvasId: 'firstCanvas',
                        success: async (res1) => {
                          tempImagePath = res1.tempFilePath;
                          const result = await this.uploadFilePromise(tempImagePath, {
                            lat: 23.129163,
                            lng: 113.264435
                          })
                          let pages = getCurrentPages();
                          let prevPage = pages[pages.length - 2];
                          // 將數(shù)據(jù)返回上一個(gè)頁(yè)面
                          prevPage.$vm[`fileList${this.name}`].push({
                            url: result
                          })
                          // setTimeout(() => {
                          uni.navigateBack();
                          // }, 500)
                        }
                      });
                    }, 500);
                  });
                }
              });
            },
            fail: (err) => {
              console.log(err, 'errhhhhhhhhhhhh')
            }
          });
        } else {
          uni.showToast({
            title: '最大上傳3張照片',
            duration: 2000,
            icon: 'none'
          });
        }
      },
      uploadFilePromise(url, lngLat) {
        // 初始化請(qǐng)求配置項(xiàng)
        let host = "";
        // #ifndef H5
        let envVs = uni.getAccountInfoSync().miniProgram.envVersion;
        if (envVs === 'release') {
          host = uni.getStorageSync('normal_url')
        } else if (envVs === 'trial') {
          host = uni.getStorageSync('exp_url')
        } else if (envVs === 'develop') {
          host = uni.getStorageSync('test_url')
        }
        // #endif
        return new Promise((resolve, reject) => {
          uni.showLoading({
            title: '上傳中'
          });
          uni.uploadFile({
            url: host + '上傳圖片接口url', // 僅為示例,非真實(shí)的接口地址
            filePath: url,
            name: 'file',
            formData: {
              type: 'order',
              lat: lngLat.lat,
              lng: lngLat.lng,
            },
            header: {
              Authorization: 'Bearer ' + uni.getStorageSync('token')
            },
            success: (res) => {
              // setTimeout(() => {
              let arr = JSON.parse(res.data)
              if (res.data.code == 0) {
                uni.$showMsg(res.data.message, 'none')
                uni.hideLoading();
              } else {
                uni.hideLoading();
                uni.$showMsg('上傳成功', 'none')
                resolve(arr.data?.url)
              }
              // }, 1000)
            },
          })
        })
      },

      getTime: function() {
        var weekarr = new Array("日", "一", "二", "三", "四", "五", "六");
        var date = new Date(),
          year = date.getFullYear(),
          month = date.getMonth() + 1,
          day = date.getDate(),
          hour = date.getHours() < 10 ? "0" + date.getHours() : date.getHours(),
          minute = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes(),
          second = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
        month >= 1 && month <= 9 ? (month = "0" + month) : "";
        day >= 0 && day <= 9 ? (day = "0" + day) : "";
        var timer = year + '-' + month + '-' + day;
        var timer3 = hour + ':' + minute + ':' + second;
        var timer2 = hour + ':' + minute
        this.nowTime = timer;
        this.nowTime2 = timer2;
        this.nowTime3 = timer3;
        this.nowWeek = '星期' + weekarr[date.getDay()];
      },
      error(e) {
        console.log(e.detail);
      },
    }
  }
</script>

<style lang="scss">
  .topBox {
    width: 750rpx;
    box-sizing: border-box;
    // padding-bottom: 200rpx;
    // padding-left: 30rpx;
    color: #EEEEEE;
    font-size: 34rpx;
    position: absolute;
    bottom: 20%;
    /* 設(shè)置小盒子距離大盒子底部的距離為0 */
    left: 50%;
    /* 設(shè)置小盒子距離大盒子左側(cè)的距離為50%,即水平居中 */
    transform: translateX(-50%);
    text-align: center;

    /* 通過(guò)transform將小盒子水平居中 */
    .topItem {
      width: 100%;
      white-space: pre-wrap;
      margin-bottom: 15rpx;
    }
  }

  .xzImg {
    width: 52rpx;
    height: auto;
    position: absolute;
    right: 44rpx;
    bottom: 160rpx;
  }


  .cameraBtn {
    width: 120rpx;
    height: 120rpx;
    line-height: 120rpx;
    border: 6rpx #FFFFFF solid;
    border-radius: 50%;
    padding: 8rpx;
    position: absolute;
    left: calc(50% - 60rpx);
    bottom: 120rpx;
  }

  .cameraBtn2 {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: #FFFFFF;
    text-align: center;
    color: #007AFF;
  }
</style>

獲取當(dāng)前地址的方法(getLocation接口記得在微信公眾平臺(tái)申請(qǐng)一下)

// 獲取當(dāng)前經(jīng)緯度
const getCurrentLngAndLat = () => {
  return new Promise((resolve, reject) => {
    uni.getLocation({
      type: 'wgs84',
      success: res => {
        let lng = res.longitude.toString()
        let lat = res.latitude.toString()
        uni.request({
          method: 'GET',
          url: `https://apis.map.qq.com/ws/geocoder/v1/?location=${lat},${lng}&key=你的key`,
          success: address => {
            const { standard_address } = address.data.result.formatted_addresses
            resolve({
              lng,
              lat,
              currentSignAddress: standard_address
            })
          },
          fail: errAddress => {
            reject({ message: errAddress.message })
          }
        })
      },
      fail: err => {
        getCurrentAddress()
      }
    })
  })
}
// 授權(quán)地理位置
const getCurrentAddress = () => {
  uni.authorize({
    scope: 'scope.userLocation',
    success() {
      getCurrentLngAndLat()
    },
    fail(err) {
      uni.showModal({
        title: '請(qǐng)您授權(quán)地理位置',
        content: '如需正常使用此小程序打卡功能,請(qǐng)您按確定并在設(shè)置頁(yè)面授權(quán)地理位置授權(quán)',
        confirmText: '確定',
        success: res => {
          if (res.confirm) {
            uni.openSetting({
              success: function(res) {
                if (res.authSetting['scope.userLocation']) {
                  uni.showToast({
                    title: '授權(quán)成功',
                    icon: 'none'
                  })
                  getCurrentLngAndLat()
                } else {
                  // 不允許
                  uni.showToast({
                    title: '授權(quán)失敗',
                    icon: 'none'
                  })
                }
              },
              fail: err => {
                console.log('err:', err)
              }
            })
          } else { //取消
            uni.showToast({
              title: '取消授權(quán)',
              icon: 'none'
            })
          }
        },
        fail: err => {
          console.log('err:', err)
        }
      })
    }
  })
}


export default getCurrentLngAndLat

代碼參考:uniapp自定義水印相機(jī)_vue+uniapp 拍照+水印-CSDN博客?文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-850836.html

到了這里,關(guān)于uniapp+uView 實(shí)現(xiàn)自定義水印相機(jī),拍完照片給圖片加水印,從相冊(cè)選擇圖片加水印功能的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來(lái)自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場(chǎng)。本站僅提供信息存儲(chǔ)空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請(qǐng)注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請(qǐng)點(diǎn)擊違法舉報(bào)進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • uniapp+uView2.0實(shí)現(xiàn)自定義動(dòng)態(tài)tabbar

    uniapp+uView2.0實(shí)現(xiàn)自定義動(dòng)態(tài)tabbar

    ???? 1.需求說(shuō)明 ???? 2.實(shí)現(xiàn)原理說(shuō)明 ???? 3.實(shí)現(xiàn)過(guò)程 ???????? 3.1集成uView2.0 ???????? 3.2 自定義tabbar ???????? 3.3 vuex定義tabbar共享信息 ???????? 3.4 tabbar顯示個(gè)數(shù)控制 ???? 要求不同時(shí)間顯示不同的tabbar.點(diǎn)擊不同的tabbar跳轉(zhuǎn)到不同的頁(yè)面,能隨時(shí)實(shí)現(xiàn)tabb

    2023年04月18日
    瀏覽(19)
  • uniapp+uview2.0+vuex實(shí)現(xiàn)自定義tabbar組件

    uniapp+uview2.0+vuex實(shí)現(xiàn)自定義tabbar組件

    效果圖 1.在components文件夾中新建MyTabbar組件 2.組件代碼 3.父組件 4.創(chuàng)建store目錄,下面創(chuàng)建index.js文件

    2024年02月04日
    瀏覽(28)
  • uniapp實(shí)現(xiàn)上傳圖片添加日期和地點(diǎn)水印,修復(fù)多張圖片同時(shí)上傳,顯示相同圖片問(wèn)題

    整體實(shí)現(xiàn)流程:首先調(diào)用 uni.chooseImage 方法,配置count、sizeType、sourceType參數(shù),分別代表選擇的圖片個(gè)數(shù)、original 原圖,compressed 壓縮圖,默認(rèn)二者都有、是從相冊(cè)還是拍照。 然后在成功的回調(diào)中拿到上傳的所有圖片并存儲(chǔ)。然后就是添加水印,調(diào)用 uni-getImageInfo 拿圖片信息,

    2024年02月12日
    瀏覽(14)
  • uniapp 水印/相機(jī)/授權(quán)位置、相機(jī)、相冊(cè)權(quán)限

    自定義相機(jī)水印 授權(quán) ?? ?// 手動(dòng)授權(quán)【攝像頭】 ?? ?function getAuth() { ?? ??? ?// 獲取攝像頭權(quán)限 ?? ??? ?uni.getSetting({ ?? ??? ??? ?success(res) { ?? ??? ??? ??? ?console.log(\\\"auth res\\\", res); ?? ??? ??? ??? ?const authSetting = res.authSetting; ?? ??? ??? ??? ?if (auth

    2024年02月02日
    瀏覽(24)
  • 圖片添加水印,仿照水印相機(jī)樣式,定位時(shí)間備注等

    圖片添加水印,仿照水印相機(jī)樣式,定位時(shí)間備注等

    開(kāi)發(fā)思路1、將每個(gè)元素添加分別單獨(dú)到背景圖片上,調(diào)整位置和透明度 開(kāi)發(fā)思路2、將水印信息先整合為一張水印圖片,再將水印圖片添加到背景圖片,調(diào)整位置和透明度 因?yàn)榭紤]到不同圖片尺寸大小等問(wèn)題,元素內(nèi)容又多,根據(jù)思路1,定位問(wèn)題太麻煩,而且還因調(diào)整大小

    2024年02月20日
    瀏覽(17)
  • uniapp實(shí)現(xiàn)自定義相機(jī)

    uniapp實(shí)現(xiàn)自定義相機(jī)

    于是開(kāi)啟了我的解決之路 利用 livePusher 實(shí)現(xiàn) 拓展性挺強(qiáng)的,可以實(shí)現(xiàn)自定義水印、身份證拍攝、人像拍攝等 這里我簡(jiǎn)單實(shí)現(xiàn)一個(gè)相機(jī)功能主要用于解決閃退 Tip:這里需要?jiǎng)?chuàng)建nvue文件哦~ 創(chuàng)建 camera.nvue 這里用了一些圖片作為圖標(biāo)布局畫(huà)面美觀,例如返回圖標(biāo),拍攝圖標(biāo) 在點(diǎn)擊

    2024年02月09日
    瀏覽(18)
  • uniapp + uview —— 上傳圖片

    index.vue 接口、請(qǐng)求頭部 方法

    2024年02月12日
    瀏覽(45)
  • uniapp+uView自定義底部tabBer

    uniapp+uView自定義底部tabBer

    HBuilderX和微信開(kāi)發(fā)工具聯(lián)合開(kāi)發(fā)小程序 一,安裝uView2 1.uView安裝 2.查看官方文檔uView配置 ?二, 1.現(xiàn)在pages文件新建四個(gè)vue頁(yè)面 2.在pages.json配置導(dǎo)航欄,因?yàn)橐谖⑿砰_(kāi)發(fā)者工具運(yùn)行,要配置custom

    2024年02月08日
    瀏覽(19)
  • uniapp實(shí)現(xiàn)自定義上傳圖片

    uniapp實(shí)現(xiàn)自定義上傳圖片

    在正式自定義上傳前我們先將靜態(tài)頁(yè)面搭建好。 樣式代碼: 通過(guò)uniapp的uni.chooseImage從本地相冊(cè)選擇圖片或使用相機(jī)拍照。 在data中定義一個(gè)響應(yīng)式數(shù)據(jù)來(lái)接收我們選擇的圖片,然后通過(guò)v-for渲染到我們的頁(yè)面,達(dá)到縮略圖的效果。 代碼: 效果: 最初我們定義了只能選擇九張

    2024年02月12日
    瀏覽(35)
  • 【uniapp】uview1.x使用upload上傳圖片

    【uniapp】uview1.x使用upload上傳圖片

    和2.x不同的是,要用 action 來(lái)配置后端上傳圖片的接口地址; 再來(lái)一些配置項(xiàng)的命名有所不同,一般1.x的命名用 - ,2.x的命名使用小駝峰; 1.x 的上傳會(huì)自帶刪除時(shí)的提示框,2.x 沒(méi)有; 重要的幾個(gè)配置項(xiàng)有: picList 初始化為一個(gè)空數(shù)組,是用來(lái)保存圖片的列表 baseUrl 為后端上

    2024年02月07日
    瀏覽(20)

覺(jué)得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請(qǐng)作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包