weex-plugin-image-picker
Version:
image-picker extend for weex
322 lines (290 loc) • 9.28 kB
JavaScript
// { "framework": "Vue" }
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {
var __vue_exports__, __vue_options__
var __vue_styles__ = []
/* styles */
__vue_styles__.push(__webpack_require__(1)
)
/* script */
__vue_exports__ = __webpack_require__(2)
/* template */
var __vue_template__ = __webpack_require__(3)
__vue_options__ = __vue_exports__ = __vue_exports__ || {}
if (
typeof __vue_exports__.default === "object" ||
typeof __vue_exports__.default === "function"
) {
if (Object.keys(__vue_exports__).some(function (key) { return key !== "default" && key !== "__esModule" })) {console.error("named exports are not supported in *.vue files.")}
__vue_options__ = __vue_exports__ = __vue_exports__.default
}
if (typeof __vue_options__ === "function") {
__vue_options__ = __vue_options__.options
}
__vue_options__.__file = "/Users/zhouchao/vagrant/web/weex-plugin/image-picker/examples/index.vue"
__vue_options__.render = __vue_template__.render
__vue_options__.staticRenderFns = __vue_template__.staticRenderFns
__vue_options__._scopeId = "data-v-13ad7722"
__vue_options__.style = __vue_options__.style || {}
__vue_styles__.forEach(function (module) {
for (var name in module) {
__vue_options__.style[name] = module[name]
}
})
if (typeof __register_static_styles__ === "function") {
__register_static_styles__(__vue_options__._scopeId, __vue_styles__)
}
module.exports = __vue_exports__
module.exports.el = 'true'
new Vue(module.exports)
/***/ }),
/* 1 */
/***/ (function(module, exports) {
module.exports = {
"container": {
"flex": 1
}
}
/***/ }),
/* 2 */
/***/ (function(module, exports) {
'use strict';
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
var plugin = weex.requireModule('imagePicker');
module.exports = {
data: {
value: '',
index: 0,
txtChange: ''
},
created: function created() {
plugin.init({
maxSelectCount: 10, //最大选择数 默认9张,最小 1
maxPreviewCount: 20, //预览图最大显示数 默认20张
allowSelectImage: true, //是否允许选择照片 默认true
allowSelectVideo: true, //是否允许选择视频 默认true
allowMixSelect: false, //是否允许混合选择,即可以同时选择image(image/gif/livephoto)、video类型, 默认true
allowSelectGif: true, //是否允许选择Gif,只是控制是否选择,并不控制是否显示,如果为NO,则不显示gif标识 默认true
allowTakePhotoInLibrary: false, //是否允许相册内部拍照 默认true
allowEditImage: true, //是否允许编辑图片,选择一张时候才允许编辑,默认true
// allowEditVideo: false, //是否允许编辑视频,选择一张时候才允许编辑,默认false
allowSelectOriginal: true //是否允许选择原图,默认true
// clipRatios:[ //裁剪比例 默认 1:1 4:3 3:2 16:9
// {
// value1:1,
// value2:1,
// },
// {
// value1:4,
// value2:3,
// },
// {
// value1:3,
// value2:2,
// },
// {
// value1:16,
// value2:9,
// }
// ],
// languageType: 1, //1.中文 2.中文繁体 3.英文 4.日文
// maxVideoDuration: 120,//允许选择视频的最大时长,单位:秒, 默认 120s
// allowRecordVideo: true, //是否允许录制视频,默认YES
// maxRecordDuration: 10, //最大录制时长,默认 10s,最小为 1s
// navBarColor: 'orange', //导航条颜色,默认 rgb(19, 153, 231)
// navTitleColor: 'green', //导航标题颜色,默认 rgb(255, 255, 255)
// bottomViewBgColor: '#FFFF00', //底部工具条底色,默认 rgb(255, 255, 255)
// bottomBtnsNormalTitleColor: '#00FFFF', //底部工具栏按钮 可交互 状态标题颜色,底部 toolbar 按钮可交互状态title颜色均使用这个,确定按钮 可交互 的背景色为这个,默认rgb(80, 180, 234)
// bottomBtnsDisableBgColor: '#000080', //底部工具栏按钮 不可交互 状态标题颜色,底部 toolbar 按钮不可交互状态颜色均使用这个,确定按钮 不可交互 的背景色为这个,默认rgb(200, 200, 200)
});
},
methods: {
showPreview: function showPreview() {
plugin.showPreview(function (images) {
console.log(JSON.stringify(images));
});
},
showImage: function showImage() {
plugin.showImage(function (images) {
console.log(JSON.stringify(images));
});
},
previewImage: function previewImage() {
plugin.previewImage({
urls: ['http://uimg.tagdat.io/site/get-url?uid=11', 'http://tmp/535D3022-B258-49AA-8056-AA070E69516F.jpeg', 'http://pic.962.net/up/2013-11/20131111660842029339.jpg', 'http://pic.962.net/up/2013-11/20131111660842034354.jpg'],
current: 'http://pic.962.net/up/2013-11/20131111660842034354.jpg'
});
},
previewSelected: function previewSelected() {
plugin.previewSelected({});
},
previewSelectedImage: function previewSelectedImage() {
plugin.previewSelectedImage({});
},
uploadFile: function uploadFile() {
plugin.uploadFile({
url: 'https://up.qiniup.com',
formData: {
key: '{hash}.{ext}',
token: '9DdPcD6YxZaB51a4RkUyg8VkH8vXmsWwuqGwf_c9:OkuLyDEI509hhfgvt2UCEGB7-Ao=:eyJkZXRlY3RNaW1lIjoxLCJzY29wZSI6InlvdWRpYW4iLCJkZWFkbGluZSI6MTUxMjM3Mzc1Mn0='
},
name: 'file',
filePath: 'http://tmp/1991D25F-668D-48B2-BABB-65331AD5A773.jpeg'
}, function (successData) {
console.log(successData);
}, function (err) {
console.log(err);
}, function (process) {
console.log(process);
});
}
}
};
/***/ }),
/* 3 */
/***/ (function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('div', {
staticClass: ["conatiner"]
}, [_c('text', {
staticStyle: {
marginBottom: "20px"
}
}, [_vm._v("weex plugin examples")]), _c('div', {
staticStyle: {
margin: "20px",
padding: "20px",
backgroundColor: "#1ba1e2",
color: "#fff"
},
on: {
"click": _vm.showPreview
}
}, [_c('text', {
staticStyle: {
color: "#fff"
}
}, [_vm._v("showPreview")])]), _c('div', {
staticStyle: {
margin: "20px",
padding: "20px",
backgroundColor: "#1ba1e2",
color: "#fff"
},
on: {
"click": _vm.showImage
}
}, [_c('text', {
staticStyle: {
color: "#fff"
}
}, [_vm._v("showImage")])]), _c('div', {
staticStyle: {
margin: "20px",
padding: "20px",
backgroundColor: "#1ba1e2",
color: "#fff"
},
on: {
"click": _vm.previewImage
}
}, [_c('text', {
staticStyle: {
color: "#fff"
}
}, [_vm._v("previewImage")])]), _c('div', {
staticStyle: {
margin: "20px",
padding: "20px",
backgroundColor: "#1ba1e2",
color: "#fff"
},
on: {
"click": _vm.previewSelected
}
}, [_c('text', {
staticStyle: {
color: "#fff"
}
}, [_vm._v("previewSelected")])]), _c('div', {
staticStyle: {
margin: "20px",
padding: "20px",
backgroundColor: "#1ba1e2",
color: "#fff"
},
on: {
"click": _vm.previewSelectedImage
}
}, [_c('text', {
staticStyle: {
color: "#fff"
}
}, [_vm._v("previewSelectedImage")])]), _c('div', {
staticStyle: {
margin: "20px",
padding: "20px",
backgroundColor: "#1ba1e2",
color: "#fff"
},
on: {
"click": _vm.uploadFile
}
}, [_c('text', {
staticStyle: {
color: "#fff"
}
}, [_vm._v("uploadFile")])])])
},staticRenderFns: []}
module.exports.render._withStripped = true
/***/ })
/******/ ]);