1 |
- {"version":3,"sources":[null,"webpack:///E:/复习/uni_app/text-installation/components/upload-photo/upload-photo.vue?09b8","webpack:///E:/复习/uni_app/text-installation/components/upload-photo/upload-photo.vue?0504","webpack:///E:/复习/uni_app/text-installation/components/upload-photo/upload-photo.vue?57a0","uni-app:///components/upload-photo/upload-photo.vue"],"names":["data","msg","userId","facePic","methods","takePhoto","uni","count","sizeType","sourceType","success","console","urlTobase64","wx","url","responseType","base64"],"mappings":";;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAyH;AACzH;AACgE;AACL;;;AAG3D;AACmL;AACnL,gBAAgB,4LAAU;AAC1B,EAAE,kFAAM;AACR,EAAE,uFAAM;AACR,EAAE,gGAAe;AACjB;AACA;AACA;AACA;AACA;AACA,EAAE,2FAAU;AACZ;AACA;;AAEA;AACe,gF;;;;;;;;;;;;ACtBf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;;;;;;;;;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;ACRA;AAAA;AAAA;AAAA;AAA4qB,CAAgB,isBAAG,EAAC,C;;;;;;;;;;;;;;;;;;;ACWhsB;;;;;;;;;;;eACA;EACAA;IACA;MACAC;QACAC;MACA;MACAC;IACA;EACA;EACAC;IACAC;MACAC;QACAC;QAAA;QACAC;QAAA;QACAC;QAAA;QACAC;UACAC;UACA;;UAEA;QACA;MACA;IACA;EAEA;EACAC;IAAA;IACAC;MACAC;MACAC;MAAA;MACAL;QACA;QACA;;QAEA;QACAM;QACA;QACA;QACAL;MACA;IACA;EACA;AAGA;AAAA,2B","file":"components/upload-photo/upload-photo.js","sourcesContent":["import { render, staticRenderFns, recyclableRender, components } from \"./upload-photo.vue?vue&type=template&id=123ab978&\"\nvar renderjs\nimport script from \"./upload-photo.vue?vue&type=script&lang=js&\"\nexport * from \"./upload-photo.vue?vue&type=script&lang=js&\"\n\n\n/* normalize component */\nimport normalizer from \"!D:\\\\gugedownload\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\vue-loader\\\\lib\\\\runtime\\\\componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n null,\n null,\n false,\n components,\n renderjs\n)\n\ncomponent.options.__file = \"components/upload-photo/upload-photo.vue\"\nexport default component.exports","export * from \"-!D:\\\\gugedownload\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\vue-loader\\\\lib\\\\loaders\\\\templateLoader.js??vue-loader-options!D:\\\\gugedownload\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\webpack-preprocess-loader\\\\index.js??ref--17-0!D:\\\\gugedownload\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\webpack-uni-mp-loader\\\\lib\\\\template.js!D:\\\\gugedownload\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\webpack-uni-app-loader\\\\page-meta.js!D:\\\\gugedownload\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\vue-loader\\\\lib\\\\index.js??vue-loader-options!D:\\\\gugedownload\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\webpack-uni-mp-loader\\\\lib\\\\style.js!./upload-photo.vue?vue&type=template&id=123ab978&\"","var components\nvar render = function () {\n var _vm = this\n var _h = _vm.$createElement\n var _c = _vm._self._c || _h\n}\nvar recyclableRender = false\nvar staticRenderFns = []\nrender._withStripped = true\n\nexport { render, staticRenderFns, recyclableRender, components }","import mod from \"-!D:\\\\gugedownload\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\babel-loader\\\\lib\\\\index.js!D:\\\\gugedownload\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\webpack-preprocess-loader\\\\index.js??ref--13-1!D:\\\\gugedownload\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\webpack-uni-mp-loader\\\\lib\\\\script.js!D:\\\\gugedownload\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\vue-loader\\\\lib\\\\index.js??vue-loader-options!D:\\\\gugedownload\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\webpack-uni-mp-loader\\\\lib\\\\style.js!./upload-photo.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!D:\\\\gugedownload\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\babel-loader\\\\lib\\\\index.js!D:\\\\gugedownload\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\webpack-preprocess-loader\\\\index.js??ref--13-1!D:\\\\gugedownload\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\webpack-uni-mp-loader\\\\lib\\\\script.js!D:\\\\gugedownload\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\vue-loader\\\\lib\\\\index.js??vue-loader-options!D:\\\\gugedownload\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\webpack-uni-mp-loader\\\\lib\\\\style.js!./upload-photo.vue?vue&type=script&lang=js&\"","<template>\r\n\t<view class=\"\">\r\n\r\n\t\t<button type=\"primary\" @click=\"takePhoto\">拍照</button>\r\n\t\t<img v-if=\"msg.facePic\" :src=\"msg.facePic\" alt=\"\">\r\n\r\n\t</view>\r\n\r\n</template>\r\n\r\n<script>\r\n\timport api from \"@/utils/api.js\"\r\n\texport default {\r\n\t\tdata() {\r\n\t\t\treturn {\r\n\t\t\t\tmsg: {\r\n\t\t\t\t\tuserId: 2,\r\n\t\t\t\t},\r\n\t\t\t\tfacePic: \"\"\r\n\t\t\t}\r\n\t\t},\r\n\t\tmethods: {\r\n\t\t\ttakePhoto() {\r\n\t\t\t\tuni.chooseImage({\r\n\t\t\t\t\tcount: 1, //选择图片的数量,默认9\r\n\t\t\t\t\tsizeType: ['compressed'], //原图、压缩图或者两者都有,可以指定原图或压缩图,默认两者都有\r\n\t\t\t\t\tsourceType: ['album', 'camera'], //从相册选择\r\n\t\t\t\t\tsuccess: function(res) {\r\n\t\t\t\t\t\tconsole.log(res);\r\n\t\t\t\t\t\tconst tempFilePaths = res.tempFilePaths; // 返回选定照片的本地文件路径列表\r\n\t\t\t\t\t\r\n\t\t\t\t\t\tthis.urlTobase64(tempFilePaths[0])\r\n\t\t\t\t\t}\r\n\t\t\t\t})\r\n\t\t\t}\r\n\r\n\t\t},\r\n\t\turlTobase64(url) {\r\n\t\t wx.request({\r\n\t\t url: url,\r\n\t\t responseType: 'arraybuffer', //最关键的参数,设置返回的数据格式为arraybuffer\r\n\t\t success: res => {\r\n\t\t //把arraybuffer转成base64\r\n\t\t let base64 = wx.arrayBufferToBase64(res.data);\r\n\t\t\r\n\t\t //不加上这串字符,在页面无法显示的哦\r\n\t\t base64 = 'data:image/jpeg;base64,' + base64\r\n\t\t this.lineBg = base64\r\n\t\t //打印出base64字符串,可复制到网页校验一下是否是你选择的原图片呢\r\n\t\t console.log('base64=>', base64)\r\n\t\t }\r\n\t\t })\r\n\t\t }\r\n\t\r\n\r\n\t}\r\n</script>"],"sourceRoot":""}
|