Browse Source

fix(打卡):上传图片添加协议配置项,样式微调

wanglj 2 years ago
parent
commit
45145dde64
1 changed files with 6 additions and 6 deletions
  1. 6 6
      pages/home/checkIn.vue

+ 6 - 6
pages/home/checkIn.vue

@@ -28,7 +28,7 @@
         <template v-if="!showList">
           <view class="btn" @click="checkIn">打卡</view>
           <view class="location">
-            <u--text @click="getLocation" :lines="1" :block="true" align="center" size="24rpx" :text="address">
+            <u--text @click="getLocation" :lines="1" :block="true" align="center" size="32rpx" :text="address">
             </u--text>
             <u-loading-icon mode="circle" size="24rpx" :show="show"></u-loading-icon>
           </view>
@@ -101,7 +101,7 @@
               header: {
                 "Content-Type": "application/text"
               },
-              url: 'http://apis.map.qq.com/ws/geocoder/v1/?location=' + latitude + ',' + longitude +
+              url: process.uniEnv.VUE_APP_PROTOCOL + 'apis.map.qq.com/ws/geocoder/v1/?location=' + latitude + ',' + longitude +
                 '&key=6REBZ-BRN6J-BMAFY-FIRI3-SMK43-G3FXU',
               success(re) {
                 if (re.statusCode === 200) {
@@ -138,18 +138,18 @@
         // this.$refs.upload.choose()
         const [err, res] = await uni.chooseImage({
           count: 1, //默认9
-          sizeType: ['original'] //可以指定是原图还是压缩图,默认二者都有
+          sizeType: ['original'], //可以指定是原图还是压缩图,默认二者都有
+          sourceType:['camera']
         })
         console.log(res, 'rs');
         if (err) return
         this.select(res)
         res.tempFiles[0].name = (new Date()).getTime() + ''
-        res.tempFiles[0].type = 'image'
+        res.tempFiles[0].type = ''
         console.log(res.tempFiles[0], typeof res.tempFiles[0])
       },
       // // 选择上传触发函数
       select(e) {
-        console.log(e)
         let url = process.uniEnv.VUE_APP_UPLOAD_WEED
         uni.request({
           url, //仅为示例,并非真实接口地址。
@@ -160,7 +160,7 @@
       },
       // 上传函数
       async uploadFiles(e, res) {
-        let action = 'http://' + res.url + '/' + res.fid
+        let action = process.uniEnv.VUE_APP_PROTOCOL + res.publicUrl + '/' + res.fid
         uni.uploadFile({
           url: action,
           filePath: e.tempFilePaths[0],