diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..4cc1c234fcc611bb32278f77f3c8adcaf43da2a7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/unpackage +/common/config.js diff --git a/App.vue b/App.vue new file mode 100644 index 0000000000000000000000000000000000000000..d6599f751d0031c0fd2c1766c01f394a743e5f2c --- /dev/null +++ b/App.vue @@ -0,0 +1,18 @@ + + + diff --git a/README.en.md b/README.en.md deleted file mode 100644 index f147a2d6d9b6f9624ab214df8f3c818f0b7ab188..0000000000000000000000000000000000000000 --- a/README.en.md +++ /dev/null @@ -1,36 +0,0 @@ -# course-tencent-cloud-app - -#### Description -酷瓜云课堂(腾讯云版)APP - -#### Software Architecture -Software architecture description - -#### Installation - -1. xxxx -2. xxxx -3. xxxx - -#### Instructions - -1. xxxx -2. xxxx -3. xxxx - -#### Contribution - -1. Fork the repository -2. Create Feat_xxx branch -3. Commit your code -4. Create Pull Request - - -#### Gitee Feature - -1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md -2. Gitee blog [blog.gitee.com](https://blog.gitee.com) -3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore) -4. The most valuable open source project [GVP](https://gitee.com/gvp) -5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help) -6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) diff --git a/README.md b/README.md index ff471f3ec0edad24d10707e50011747dc76c1065..506da8183594c8416f63fb572ce7ebc148b64928 100644 --- a/README.md +++ b/README.md @@ -1,37 +1,126 @@ -# course-tencent-cloud-app +## 酷瓜云课堂客户端 -#### 介绍 -酷瓜云课堂(腾讯云版)APP +酷瓜云课堂客户端采用 [uni-app](https://uniapp.dcloud.io) 为基础开发框架,前端界面使用 [uview-ui](http://uviewui.com) -#### 软件架构 -软件架构说明 +### 相关项目 +- PC端以及API [course-tencent-cloud](https://gitee.com/koogua/course-tencent-cloud) +- docker运行环境 [course-tencent-cloud-docker](https://gitee.com/koogua/course-tencent-cloud-docker) -#### 安装教程 +### 安装使用 -1. xxxx -2. xxxx -3. xxxx +为避免不必要的困扰,请先熟悉 [uni-app](https://uniapp.dcloud.io) 相关文档,以及 [HBuilderX](https://www.dcloud.io/hbuilderx.html) 开发工具 -#### 使用说明 +#### 下载源码 -1. xxxx -2. xxxx -3. xxxx +``` +git clone https://gitee.com/koogua/course-tencent-cloud-app.git +``` -#### 参与贡献 +#### 导入项目 -1. Fork 本仓库 -2. 新建 Feat_xxx 分支 -3. 提交代码 -4. 新建 Pull Request +使用HBuilderX导入项目(文件->导入->从本地目录导入) +#### 修改配置文件 + +把 `common/config.sample.js` 另存为 `common/config.js`, 修改 `apiBaseUrl` 为实际的地址(尾部不要加“/”) + +``` +export const apiBaseUrl = '{{ your-domain }}/api' +``` + +#### 运行 + +遇到跨域的问题,请修改 `course-tencent-cloud` 项目中的配置文件 `app/config/config.php` CORS 相关部分。 + +**注意:开发环境跨域域名可使用通配符, 非开发环境请使用实际的域名** + +``` +/** + * 允许跨域 + */ +$config['cors']['enabled'] = true; + +/** + * 允许跨域域名(字符|数组) + */ +$config['cors']['allow_origin'] = '*'; + +/** + * 允许跨域字段(string|array) + */ +$config['cors']['allow_headers'] = '*'; + +/** + * 允许跨域方法 + */ +$config['cors']['allow_methods'] = ['GET', 'POST', 'OPTIONS']; +``` + +### 发行 + +#### H5发行 + +(a) 发布的文件上传到服务器本地 + +把生成的目录 `upackage/dist/build/h5` 上传到 `course-tencent-cloud` 项目的 `public`目录下 + +对应的 `manifest.json` h5部分配置如下: + +``` +"h5" : { + "title" : "酷瓜云课堂", + "optimization" : { + "treeShaking" : { + "enable" : true + } + }, + "router" : { + "base" : "/h5/", + "mode" : "hash" + }, + "sdkConfigs" : { + "maps" : {} + }, + "publicPath" : "", + "template" : "template.h5.html", + "domain" : "your-domain.com" + } +``` + +(b) 发布的文件上传到CDN + +把生成的目录 `upackage/dist/build/h5` 上传到 腾讯云存储相关 bucket 的相关目录下 + +把 `upackage/dist/build/h5/index.html` 上传到 `course-tencent-cloud` 项目的 `public/h5`目录下 + +对应的 `manifest.json` h5部分配置如下: + +``` +"h5" : { + "title" : "酷瓜云课堂", + "optimization" : { + "treeShaking" : { + "enable" : true + } + }, + "router" : { + "base" : "/h5/", + "mode" : "hash" + }, + "sdkConfigs" : { + "maps" : {} + }, + "publicPath" : "https://course-1255691183.file.myqcloud.com/static/h5", + "template" : "template.h5.html", + "domain" : "your-domain.com" + } +``` + +如果访问页面遇到403错误,修改 `public/h5/index.html` 的文件权限 + +``` +chmod 644 public/h5/index.html +``` -#### 特技 -1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md -2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com) -3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目 -4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目 -5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) -6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) diff --git a/common/about.js b/common/about.js new file mode 100644 index 0000000000000000000000000000000000000000..942db705aa916db0fc393470e5431038a3c39fce --- /dev/null +++ b/common/about.js @@ -0,0 +1,12 @@ +/** + * NOTE:尾部不要加"/" + */ +//export const apiBaseUrl = 'https://ctc.koogua.com/api' +export const apiBaseUrl = 'http://10.86.41.156/api' + +export const appInfo = { + name: '酷瓜云课堂', + alias: 'ctc-app', + link: 'https://gitee.com/koogua/course-tencent-cloud-app', + version: '1.0.0' +} diff --git a/common/api.js b/common/api.js new file mode 100644 index 0000000000000000000000000000000000000000..70f435241e835a9e18dbc5e11d39ec19ada0cc2e --- /dev/null +++ b/common/api.js @@ -0,0 +1,421 @@ +import * as About from '@/common/about.js' +import * as Config from '@/common/config.js' +import * as Utils from '@/common/utils.js' +import * as Storage from '@/common/storage.js' + +export const search = (params) => { + return httpGet('/search', params) +} + +export const getSocketInfo = () => { + return httpGet('/socket/info') +} + +export const getSiteInfo = () => { + return httpGet('/site/info') +} + +export const getCaptchaInfo = () => { + return httpGet('/captcha/info') +} + +export const getRewardOptions = () => { + return httpGet('/reward/options') +} + +export const getVipOptions = () => { + return httpGet('/vip/options') +} + +export const getHelpList = () => { + return httpGet('/help/list') +} + +export const getHelpInfo = (id) => { + return httpGet(`/help/${id}/info`) +} + +export const getPageInfo = (id) => { + return httpGet(`/page/${id}/info`) +} + +export const getIndexSlides = () => { + return httpGet('/index/slides') +} + +export const getIndexNewCourses = () => { + return httpGet('/index/courses/new') +} + +export const getIndexFreeCourses = () => { + return httpGet('/index/courses/free') +} + +export const getIndexVipCourses = () => { + return httpGet('/index/courses/vip') +} + +export const getCourseCategories = () => { + return httpGet('/course/categories') +} + +export const getCourseList = (params = {}) => { + return httpGet('/course/list', params) +} + +export const getCourseInfo = (id) => { + return httpGet(`/course/${id}/info`) +} + +export const getCourseChapters = (id) => { + return httpGet(`/course/${id}/chapters`) +} + +export const getCoursePackages = (id) => { + return httpGet(`/course/${id}/packages`) +} + +export const getCourseReviews = (id, params = {}) => { + return httpGet(`/course/${id}/reviews`, params) +} + +export const getCourseConsults = (id, params = {}) => { + return httpGet(`/course/${id}/consults`, params) +} + +export const favoriteCourse = (id) => { + return httpPost(`/course/${id}/favorite`) +} + +export const getChapterInfo = (id) => { + return httpGet(`/chapter/${id}/info`) +} + +export const getChapterConsults = (id, params = {}) => { + return httpGet(`/chapter/${id}/consults`, params) +} + +export const getChapterResources = (id) => { + return httpGet(`/chapter/${id}/resources`) +} + +export const likeChapter = (id) => { + return httpPost(`/chapter/${id}/like`) +} + +export const learningChapter = (id, params) => { + return httpPost(`/chapter/${id}/learning`, params) +} + +export const getLiveList = () => { + return httpGet('/live/list') +} + +export const getLiveChats = (id) => { + return httpGet(`/live/${id}/chats`) +} + +export const bindLiveUser = (id, params) => { + return httpPost(`/live/${id}/user/bind`, params) +} + +export const sendLiveMessage = (id, params) => { + return httpPost(`/live/${id}/msg/send`, params) +} + +export const createConsult = (params) => { + return httpPost('/consult/create', params) +} + +export const getConsultInfo = (id) => { + return httpGet(`/consult/${id}/info`) +} + +export const updateConsult = (id, params) => { + return httpPost(`/consult/${id}/update`, params) +} + +export const deleteConsult = (id) => { + return httpPost(`/consult/${id}/delete`) +} + +export const likeConsult = (id) => { + return httpPost(`/consult/${id}/like`) +} + +export const createReview = (params) => { + return httpPost('/review/create', params) +} + +export const getReviewInfo = (id) => { + return httpGet(`/review/${id}/info`) +} + +export const updateReview = (id, params) => { + return httpPost(`/review/${id}/update`, params) +} + +export const deleteReview = (id) => { + return httpPost(`/review/${id}/delete`) +} + +export const likeReview = (id) => { + return httpPost(`/review/${id}/like`) +} + +export const unlikeReview = (id) => { + return httpPost(`/review/${id}/unlike`) +} + +export const getOrderInfo = (sn) => { + return httpGet('/order/info', { + sn: sn + }) +} + +export const getOrderConfirm = (itemId, itemType) => { + return httpGet('/order/confirm', { + item_id: itemId, + item_type: itemType + }) +} + +export const createOrder = (params) => { + return httpPost('/order/create', params) +} + +export const cancelOrder = (sn) => { + return httpPost('/order/cancel', { + sn: sn + }) +} + +export const getRefundConfirm = (sn) => { + return httpGet('/refund/confirm', { + sn: sn + }) +} + +export const getRefundInfo = (sn) => { + return httpGet('/refund/info', { + sn: sn + }) +} + +export const createRefund = (params) => { + return httpPost('/refund/create', params) +} + +export const cancelRefund = (sn) => { + return httpPost('/refund/cancel', { + sn: sn + }) +} + +export const getTradeInfo = (sn) => { + return httpGet('/trade/info', { + sn: sn + }) +} + +export const createH5Trade = (params) => { + return httpPost('/trade/h5/create', params) +} + +export const createMpTrade = (params) => { + return httpPost('/trade/mp/create', params) +} + +export const createAppTrade = (params) => { + return httpPost('/trade/app/create', params) +} + +export const getImGroupList = (params = {}) => { + return httpGet('/im/group/list', params) +} + +export const getImGroupInfo = (id) => { + return httpGet(`/im/group/${id}/info`) +} + +export const getImGroupUsers = (id, params = {}) => { + return httpGet(`/im/group/${id}/users`, params) +} + +export const getTeacherList = (params = {}) => { + return httpGet('/teacher/list', params) +} + +export const getTeacherInfo = (id) => { + return httpGet(`/teacher/${id}/info`) +} + +export const getTeacherCourses = (id, params = {}) => { + return httpGet(`/teacher/${id}/courses`, params) +} + +export const getUserInfo = (id) => { + return httpGet(`/user/${id}/info`) +} + +export const getUserCourses = (id, params = {}) => { + return httpGet(`/user/${id}/courses`, params) +} + +export const getUserFavorites = (id, params = {}) => { + return httpGet(`/user/${id}/favorites`, params) +} + +export const getUserFriends = (id, params = {}) => { + return httpGet(`/user/${id}/friends`, params) +} + +export const getUserGroups = (id, params = {}) => { + return httpGet(`/user/${id}/groups`, params) +} + +export const getMyProfile = () => { + return httpGet('/uc/profile') +} + +export const getMyAccount = () => { + return httpGet('/uc/account') +} + +export const getMyOrders = (params = {}) => { + return httpGet('/uc/orders', params) +} + +export const getMyRefunds = (params = {}) => { + return httpGet('/uc/refunds', params) +} + +export const getMyCourses = (params = {}) => { + return httpGet('/uc/courses', params) +} + +export const getMyConsults = (params = {}) => { + return httpGet('/uc/consults', params) +} + +export const getMyReviews = (params = {}) => { + return httpGet('/uc/reviews', params) +} + +export const getMyFavorites = (params = {}) => { + return httpGet('/uc/favorites', params) +} + +export const getMyFriends = (params = {}) => { + return httpGet('/uc/friends', params) +} + +export const getMyGroups = (params = {}) => { + return httpGet('/uc/groups', params) +} + +export const updateMyProfile = (params = {}) => { + return httpPost('/uc/profile/update', params) +} + +export const registerAccount = (params = {}) => { + return httpPost('/account/register', params) +} + +export const loginByPassword = (params = {}) => { + return httpPost('/account/password/login', params) +} + +export const loginByVerify = (params = {}) => { + return httpPost('/account/verify/login', params) +} + +export const logoutAccount = (params = {}) => { + return httpPost('/account/logout', params) +} + +export const resetPassword = (params = {}) => { + return httpPost('/account/password/reset', params) +} + +export const updatePhone = (params = {}) => { + return httpPost('/account/phone/update', params) +} + +export const updateEmail = (params = {}) => { + return httpPost('/account/email/update', params) +} + +export const updatePassword = (params = {}) => { + return httpPost('/account/password/update', params) +} + +export const sendSmsVerifyCode = (params = {}) => { + return httpPost('/verify/sms/code', params) +} + +export const sendEmailVerifyCode = (params = {}) => { + return httpPost('/verify/email/code', params) +} + +export const uploadAvatar = (filePath) => { + return new Promise((resolve, reject) => { + uni.uploadFile({ + url: Config.apiBaseUrl + '/upload/avatar/img', + name: 'file', + filePath: filePath, + success: (res) => { + resolve(res) + }, + fail: (e) => { + reject(e) + } + }) + }) +} + +const httpGet = (path, params = {}, header = {}) => { + return httpRequest(path, params, 'GET', header) +} + +const httpPost = (path, params = {}, header = {}) => { + return httpRequest(path, params, 'POST', header) +} + +const httpRequest = (path, params = {}, method = 'GET', header = {}) => { + + let url = Config.apiBaseUrl + path + + header['X-Version'] = About.appInfo.version + header['X-Platform'] = Utils.getPlatform() + header['X-Timestamp'] = Utils.getNowTime() + header['X-Token'] = Storage.get(Storage.cacheKey.token) + + return new Promise(function(resolve, reject) { + uni.request({ + url: url, + data: params, + method: method, + header: header, + success: function(res) { + if (res.statusCode == 200) { + if (res.data.code == 0) { + resolve(res.data) + } else { + reject(res.data) + } + } else if (res.statusCode == 401) { + Utils.clearToken() + uni.navigateTo({ + url: '/pages/account/login' + }) + } else { + reject(res.data) + } + }, + fail: function(err) { + reject(err) + } + }) + }) +} diff --git a/common/captcha.js b/common/captcha.js new file mode 100644 index 0000000000000000000000000000000000000000..dc7f46d2cadc8cad8ea0411afd0ef9fc5e28b048 --- /dev/null +++ b/common/captcha.js @@ -0,0 +1,49 @@ +"use strict" + +import * as Api from '@/common/api.js' + +/** + * 加载验证码JS文件 + */ +function loadScript(url) { + return new Promise((resolve, reject) => { + if (window.TencentCaptcha == undefined) { + let script = document.createElement("script") + let head = document.getElementsByTagName("head")[0] + script.type = "text/javascript" + script.charset = "UTF-8" + script.src = url + head.appendChild(script) + script.onload = function() { + resolve() + }; + script.onerror = function() { + reject(new Error("验证码脚本加载失败,请重试")) + }; + } else { + resolve() + } + }); +} + +/** + * 验证码creater + * @param {function} callback 回调函数, 回调结果请参见 https://cloud.tencent.com/document/product/1110/36841 + * @param {object} options 更多配置参数, 请参见 https://cloud.tencent.com/document/product/1110/36841#pzcs + * @returns {Promise} 返回TencentCaptcha的实例提供一些操作验证码的方法 + */ +async function captchaCreater(callback, options) { + try { + await loadScript("https://ssl.captcha.qq.com/TCaptcha.js"); + const appId = await Api.getCaptchaInfo().then(res => { + return res.captcha.app_id + }) + return new TencentCaptcha(appId, callback, options) + } catch (error) { + throw new Error(error) + } +} + +export { + captchaCreater +} diff --git a/common/config.sample.js b/common/config.sample.js new file mode 100644 index 0000000000000000000000000000000000000000..0088c6cf55c29bb8b5c4aae81ca98c356e07e840 --- /dev/null +++ b/common/config.sample.js @@ -0,0 +1,4 @@ +/** + * NOTE:尾部不要加"/" + */ +export const apiBaseUrl = 'https://ctc.koogua.com/api' diff --git a/common/md5.js b/common/md5.js new file mode 100644 index 0000000000000000000000000000000000000000..713d6401d28ac6b4ee43a49902cf0b71f0ad4f42 --- /dev/null +++ b/common/md5.js @@ -0,0 +1,263 @@ +/* + * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message + * Digest Algorithm, as defined in RFC 1321. + * Version 2.1 Copyright (C) Paul Johnston 1999 - 2002. + * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet + * Distributed under the BSD License + * See http://pajhome.org.uk/crypt/md5 for more info. + */ + +/* + * Configurable variables. You may need to tweak these to be compatible with + * the server-side, but the defaults work in most cases. + */ +var hexcase = 0; /* hex output format. 0 - lowercase; 1 - uppercase */ +var b64pad = ""; /* base-64 pad character. "=" for strict RFC compliance */ +var chrsz = 8; /* bits per input character. 8 - ASCII; 16 - Unicode */ + +/* + * These are the functions you'll usually want to call + * They take string arguments and return either hex or base-64 encoded strings + */ +function hex_md5(s) { + return binl2hex(core_md5(str2binl(s), s.length * chrsz)); +} + +function b64_md5(s) { + return binl2b64(core_md5(str2binl(s), s.length * chrsz)); +} + +function str_md5(s) { + return binl2str(core_md5(str2binl(s), s.length * chrsz)); +} + +function hex_hmac_md5(key, data) { + return binl2hex(core_hmac_md5(key, data)); +} + +function b64_hmac_md5(key, data) { + return binl2b64(core_hmac_md5(key, data)); +} + +function str_hmac_md5(key, data) { + return binl2str(core_hmac_md5(key, data)); +} + +/* + * Perform a simple self-test to see if the VM is working + */ +function md5_vm_test() { + return hex_md5("abc") == "900150983cd24fb0d6963f7d28e17f72"; +} + +/* + * Calculate the MD5 of an array of little-endian words, and a bit length + */ +function core_md5(x, len) { + /* append padding */ + x[len >> 5] |= 0x80 << ((len) % 32); + x[(((len + 64) >>> 9) << 4) + 14] = len; + + var a = 1732584193; + var b = -271733879; + var c = -1732584194; + var d = 271733878; + + for (var i = 0; i < x.length; i += 16) { + var olda = a; + var oldb = b; + var oldc = c; + var oldd = d; + + a = md5_ff(a, b, c, d, x[i + 0], 7, -680876936); + d = md5_ff(d, a, b, c, x[i + 1], 12, -389564586); + c = md5_ff(c, d, a, b, x[i + 2], 17, 606105819); + b = md5_ff(b, c, d, a, x[i + 3], 22, -1044525330); + a = md5_ff(a, b, c, d, x[i + 4], 7, -176418897); + d = md5_ff(d, a, b, c, x[i + 5], 12, 1200080426); + c = md5_ff(c, d, a, b, x[i + 6], 17, -1473231341); + b = md5_ff(b, c, d, a, x[i + 7], 22, -45705983); + a = md5_ff(a, b, c, d, x[i + 8], 7, 1770035416); + d = md5_ff(d, a, b, c, x[i + 9], 12, -1958414417); + c = md5_ff(c, d, a, b, x[i + 10], 17, -42063); + b = md5_ff(b, c, d, a, x[i + 11], 22, -1990404162); + a = md5_ff(a, b, c, d, x[i + 12], 7, 1804603682); + d = md5_ff(d, a, b, c, x[i + 13], 12, -40341101); + c = md5_ff(c, d, a, b, x[i + 14], 17, -1502002290); + b = md5_ff(b, c, d, a, x[i + 15], 22, 1236535329); + + a = md5_gg(a, b, c, d, x[i + 1], 5, -165796510); + d = md5_gg(d, a, b, c, x[i + 6], 9, -1069501632); + c = md5_gg(c, d, a, b, x[i + 11], 14, 643717713); + b = md5_gg(b, c, d, a, x[i + 0], 20, -373897302); + a = md5_gg(a, b, c, d, x[i + 5], 5, -701558691); + d = md5_gg(d, a, b, c, x[i + 10], 9, 38016083); + c = md5_gg(c, d, a, b, x[i + 15], 14, -660478335); + b = md5_gg(b, c, d, a, x[i + 4], 20, -405537848); + a = md5_gg(a, b, c, d, x[i + 9], 5, 568446438); + d = md5_gg(d, a, b, c, x[i + 14], 9, -1019803690); + c = md5_gg(c, d, a, b, x[i + 3], 14, -187363961); + b = md5_gg(b, c, d, a, x[i + 8], 20, 1163531501); + a = md5_gg(a, b, c, d, x[i + 13], 5, -1444681467); + d = md5_gg(d, a, b, c, x[i + 2], 9, -51403784); + c = md5_gg(c, d, a, b, x[i + 7], 14, 1735328473); + b = md5_gg(b, c, d, a, x[i + 12], 20, -1926607734); + + a = md5_hh(a, b, c, d, x[i + 5], 4, -378558); + d = md5_hh(d, a, b, c, x[i + 8], 11, -2022574463); + c = md5_hh(c, d, a, b, x[i + 11], 16, 1839030562); + b = md5_hh(b, c, d, a, x[i + 14], 23, -35309556); + a = md5_hh(a, b, c, d, x[i + 1], 4, -1530992060); + d = md5_hh(d, a, b, c, x[i + 4], 11, 1272893353); + c = md5_hh(c, d, a, b, x[i + 7], 16, -155497632); + b = md5_hh(b, c, d, a, x[i + 10], 23, -1094730640); + a = md5_hh(a, b, c, d, x[i + 13], 4, 681279174); + d = md5_hh(d, a, b, c, x[i + 0], 11, -358537222); + c = md5_hh(c, d, a, b, x[i + 3], 16, -722521979); + b = md5_hh(b, c, d, a, x[i + 6], 23, 76029189); + a = md5_hh(a, b, c, d, x[i + 9], 4, -640364487); + d = md5_hh(d, a, b, c, x[i + 12], 11, -421815835); + c = md5_hh(c, d, a, b, x[i + 15], 16, 530742520); + b = md5_hh(b, c, d, a, x[i + 2], 23, -995338651); + + a = md5_ii(a, b, c, d, x[i + 0], 6, -198630844); + d = md5_ii(d, a, b, c, x[i + 7], 10, 1126891415); + c = md5_ii(c, d, a, b, x[i + 14], 15, -1416354905); + b = md5_ii(b, c, d, a, x[i + 5], 21, -57434055); + a = md5_ii(a, b, c, d, x[i + 12], 6, 1700485571); + d = md5_ii(d, a, b, c, x[i + 3], 10, -1894986606); + c = md5_ii(c, d, a, b, x[i + 10], 15, -1051523); + b = md5_ii(b, c, d, a, x[i + 1], 21, -2054922799); + a = md5_ii(a, b, c, d, x[i + 8], 6, 1873313359); + d = md5_ii(d, a, b, c, x[i + 15], 10, -30611744); + c = md5_ii(c, d, a, b, x[i + 6], 15, -1560198380); + b = md5_ii(b, c, d, a, x[i + 13], 21, 1309151649); + a = md5_ii(a, b, c, d, x[i + 4], 6, -145523070); + d = md5_ii(d, a, b, c, x[i + 11], 10, -1120210379); + c = md5_ii(c, d, a, b, x[i + 2], 15, 718787259); + b = md5_ii(b, c, d, a, x[i + 9], 21, -343485551); + + a = safe_add(a, olda); + b = safe_add(b, oldb); + c = safe_add(c, oldc); + d = safe_add(d, oldd); + } + return Array(a, b, c, d); + +} + +/* + * These functions implement the four basic operations the algorithm uses. + */ +function md5_cmn(q, a, b, x, s, t) { + return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s), b); +} + +function md5_ff(a, b, c, d, x, s, t) { + return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t); +} + +function md5_gg(a, b, c, d, x, s, t) { + return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t); +} + +function md5_hh(a, b, c, d, x, s, t) { + return md5_cmn(b ^ c ^ d, a, b, x, s, t); +} + +function md5_ii(a, b, c, d, x, s, t) { + return md5_cmn(c ^ (b | (~d)), a, b, x, s, t); +} + +/* + * Calculate the HMAC-MD5, of a key and some data + */ +function core_hmac_md5(key, data) { + var bkey = str2binl(key); + if (bkey.length > 16) bkey = core_md5(bkey, key.length * chrsz); + + var ipad = Array(16), + opad = Array(16); + for (var i = 0; i < 16; i++) { + ipad[i] = bkey[i] ^ 0x36363636; + opad[i] = bkey[i] ^ 0x5C5C5C5C; + } + + var hash = core_md5(ipad.concat(str2binl(data)), 512 + data.length * chrsz); + return core_md5(opad.concat(hash), 512 + 128); +} + +/* + * Add integers, wrapping at 2^32. This uses 16-bit operations internally + * to work around bugs in some JS interpreters. + */ +function safe_add(x, y) { + var lsw = (x & 0xFFFF) + (y & 0xFFFF); + var msw = (x >> 16) + (y >> 16) + (lsw >> 16); + return (msw << 16) | (lsw & 0xFFFF); +} + +/* + * Bitwise rotate a 32-bit number to the left. + */ +function bit_rol(num, cnt) { + return (num << cnt) | (num >>> (32 - cnt)); +} + +/* + * Convert a string to an array of little-endian words + * If chrsz is ASCII, characters >255 have their hi-byte silently ignored. + */ +function str2binl(str) { + var bin = Array(); + var mask = (1 << chrsz) - 1; + for (var i = 0; i < str.length * chrsz; i += chrsz) + bin[i >> 5] |= (str.charCodeAt(i / chrsz) & mask) << (i % 32); + return bin; +} + +/* + * Convert an array of little-endian words to a string + */ +function binl2str(bin) { + var str = ""; + var mask = (1 << chrsz) - 1; + for (var i = 0; i < bin.length * 32; i += chrsz) + str += String.fromCharCode((bin[i >> 5] >>> (i % 32)) & mask); + return str; +} + +/* + * Convert an array of little-endian words to a hex string. + */ +function binl2hex(binarray) { + var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef"; + var str = ""; + for (var i = 0; i < binarray.length * 4; i++) { + str += hex_tab.charAt((binarray[i >> 2] >> ((i % 4) * 8 + 4)) & 0xF) + + hex_tab.charAt((binarray[i >> 2] >> ((i % 4) * 8)) & 0xF); + } + return str; +} + +/* + * Convert an array of little-endian words to a base-64 string + */ +function binl2b64(binarray) { + var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + var str = ""; + for (var i = 0; i < binarray.length * 4; i += 3) { + var triplet = (((binarray[i >> 2] >> 8 * (i % 4)) & 0xFF) << 16) | + (((binarray[i + 1 >> 2] >> 8 * ((i + 1) % 4)) & 0xFF) << 8) | + ((binarray[i + 2 >> 2] >> 8 * ((i + 2) % 4)) & 0xFF); + for (var j = 0; j < 4; j++) { + if (i * 8 + j * 6 > binarray.length * 32) str += b64pad; + else str += tab.charAt((triplet >> 6 * (3 - j)) & 0x3F); + } + } + return str; +} + +module.exports = { + hex_md5 +} diff --git a/common/storage.js b/common/storage.js new file mode 100644 index 0000000000000000000000000000000000000000..b40fbdbb1a2fce9334b38ca87a870e46bbc0d952 --- /dev/null +++ b/common/storage.js @@ -0,0 +1,63 @@ +export const cacheKey = { + token: 'kg:token' +} + +export const get = (key, sync = true) => { + try { + if (sync) { + return uni.getStorageSync(key); + } else { + let data = ''; + uni.getStorage({ + key: key, + success: function(res) { + data = res.data; + } + }); + return data; + } + } catch (e) { + return false; + } +} + +export const set = (key, value, sync = true) => { + try { + if (sync) { + return uni.setStorageSync(key, value); + } else { + uni.setStorage({ + key: key, + data: value + }); + } + } catch (e) { + + } +} + +export const remove = (key, sync = true) => { + try { + if (sync) { + return uni.removeStorageSync(key); + } else { + uni.removeStorage({ + key: key + }); + } + } catch (e) { + return false; + } +} + +export const clear = (sync = true) => { + try { + if (sync) { + return uni.clearStorageSync(); + } else { + uni.clearStorage(); + } + } catch (e) { + return false; + } +} diff --git a/common/tcplayer.js b/common/tcplayer.js new file mode 100644 index 0000000000000000000000000000000000000000..ddec7fc777cae71e2a9f504391003f0ffd403003 --- /dev/null +++ b/common/tcplayer.js @@ -0,0 +1,4 @@ +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.TcPlayer=t():e.TcPlayer=t()}(this,function(){return function(e){function t(o){if(i[o])return i[o].exports;var n=i[o]={exports:{},id:o,loaded:!1};return e[o].call(n.exports,n,n.exports,t),n.loaded=!0,n.exports}var i={};return t.m=e,t.c=i,t.p="//imgcache.qq.com/open/qcloud/video/vcplayer/",t(0)}([function(e,t,i){"use strict";function o(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t["default"]=e,t}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function l(e,t){if(d.IS_MOBILE?(e.flash=!1,d.IS_X5TBS&&e.x5_player?b.mobile=["flv","m3u8","mp4"]:d.IS_ENABLED_MSE&&e.h5_flv&&(b.mobile=["flv","m3u8","mp4"])):(e.flash=!!t.isFormat("rtmp")||e.flash,t.isFormat("flv")&&void 0==e.flash&&(e.flash=!0),e.flash?d.IS_ENABLED_FLASH||(e.flash=!1,d.IS_ENABLED_MSE?e.h5_flv&&(d.IS_SAFARI&&A.compareVersion(d.SAFARI_VERSION,"10.1")>-1||!d.IS_SAFARI)?b.pc=["flv","m3u8","mp4"]:b.pc=["m3u8","mp4"]:b.pc=["mp4"]):d.IS_ENABLED_MSE?e.h5_flv&&(d.IS_SAFARI&&A.compareVersion(d.SAFARI_VERSION,"10.1")>-1||!d.IS_SAFARI)?b.pc=["flv","m3u8","mp4"]:b.pc=["m3u8","mp4"]:d.IS_ENABLED_FLASH?e.flash=!0:b.pc=["mp4"]),e.clarity){var i=M.indexOf(e.clarity);M.splice(i,1),M.unshift(e.clarity)}}function a(e){var t={urls:{m3u8:{od:e.m3u8||"",hd:e.m3u8_hd||"",sd:e.m3u8_sd||""},flv:{od:e.flv||"",hd:e.flv_hd||"",sd:e.flv_sd||""},mp4:{od:e.mp4||"",hd:e.mp4_hd||"",sd:e.mp4_sd||""},rtmp:{od:e.rtmp||"",hd:e.rtmp_hd||"",sd:e.rtmp_sd||""}},isClarity:function(e){var i=t.urls;return!!(i.m3u8[e]||i.flv[e]||i.mp4[e]||i.rtmp[e])},isFormat:function(e){var i=t.urls;return!!i[e].od||!!i[e].hd||!!i[e].sd},hasUrl:function(){return this.isFormat("rtmp")||this.isFormat("flv")||this.isFormat("m3u8")||this.isFormat("mp4")}};t.definitions=[];for(var i=0;i3&&void 0!==arguments[3]?arguments[3]:b,n="",r=void 0;i=i||(d.IS_MOBILE?o.mobile:o.pc);for(var s=0;s2&&void 0!==arguments[2]?arguments[2]:M,o="",n=0;n1&&void 0!==arguments[1]?arguments[1]:b,i=void 0,o="",n=e.urls,r=d.IS_MOBILE?t.mobile:t.pc,s=0;s0&&!this.options.live&&this.currentTime(t),n&&this.play(!0),g.unsub(w.MetaLoaded,"*",r,this)});g.sub(w.MetaLoaded,"*",r,this)},t.prototype.switchClarity=function(e){this.claritySwitcher?this.claritySwitcher.setClarity(e):this._switchClarity(e)},t.prototype.handleMsg=function(t){e.prototype.handleMsg.call(this,t)},t}(m.Player)},function(e,t){"use strict";t.__esModule=!0;var i=window.navigator.userAgent,o=/AppleWebKit\/([\d.]+)/i.exec(i),n=o?parseFloat(o.pop()):null,r=t.IS_IPAD=/iPad/i.test(i),s=t.IS_IPHONE=/iPhone/i.test(i)&&!r,l=t.IS_IPOD=/iPod/i.test(i),a=t.IS_IOS=s||r||l,c=(t.IOS_VERSION=function(){var e=i.match(/OS (\d+)_/i);if(e&&e[1])return e[1]}(),t.IS_MAC=/Mac/i.test(i),t.IS_ANDROID=/Android/i.test(i)),u=t.ANDROID_VERSION=function(){var e,t,o=i.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);return o?(e=o[1]&&parseFloat(o[1]),t=o[2]&&parseFloat(o[2]),e&&t?parseFloat(o[1]+"."+o[2]):e?e:null):null}(),p=(t.IS_OLD_ANDROID=c&&/webkit/i.test(i)&&u<2.3,t.IS_NATIVE_ANDROID=c&&u<5&&n<537,t.IS_FIREFOX=/Firefox/i.test(i),t.IS_EDGE=/Edge/i.test(i)),h=t.IS_CHROME=!p&&/Chrome/i.test(i),d=t.IS_SAFARI=!p&&!h&&/Safari/i.test(i),f=(t.SAFARI_VERSION=function(){if(!d)return null;var e=/version\/([\d.]+)/i,t=i.match(e);return t?t[1]:void 0}(),t.IS_IE8=/MSIE\s8\.0/.test(i),t.IS_IE9=/MSIE\s9\.0/.test(i),t.IS_IE=/(msie\s|trident.*rv:)([\w.]+)/i.test(i)),y=(t.IE_VERSION=function(){var e=/(msie\s|trident.*rv:)([\w.]+)/i,t=i.match(e);return t?t[2]:null}(),t.TOUCH_ENABLED=!!("ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch),t.BACKGROUND_SIZE_SUPPORTED="backgroundSize"in document.createElement("video").style,t.HASVIDEO=!!document.createElement("video").canPlayType,t.IS_X5TBS=/TBS\/\d+/i.test(i)),A=(t.TBS_VERSION=function(){var e=i.match(/TBS\/(\d+)/i);if(e&&e[1])return e[1]}(),t.IS_MQQB=!y&&/MQQBrowser\/\d+/i.test(i),t.IS_QQB=!y&&/ QQBrowser\/\d+/i.test(i),t.IS_WECHAT=/(micromessenger|webbrowser)/i.test(i),t.IS_MQQ=/ QQ\/\d+/i.test(i),t.IS_MOBILE=c||a,t.IS_FILE_PROTOCOL=/file:/.test(location.protocol),t.FLASH_VERSION=null);t.IS_ENABLED_FLASH=function(){var e;if(document.all||f)try{if(e=new ActiveXObject("ShockwaveFlash.ShockwaveFlash"))return t.FLASH_VERSION=A=e.GetVariable("$version").split(" ")[1].replace(/,/g,"."),window.console&&console.log("FLASH_VERSION",A),!0}catch(e){return!1}else try{if(navigator.plugins&&navigator.plugins.length>0&&(e=navigator.plugins["Shockwave Flash"])){for(var i=e.description.split(" "),o=0;o-1?"Edge":i.indexOf(".NET")>-1?"IE":i.indexOf("QQBrowser")>-1?"QQBrowser":i.indexOf("Mac OS")>-1?"safari":i.indexOf("Chrome")>-1?"chrome":"other"}()},function(e,t){"use strict";function i(e,t,i){return e?(e.addEventListener?e.addEventListener(t,i,!1):e.attachEvent&&e.attachEvent("on"+t,i),i):console.warn("element not exists")}function o(e,t,i){return e?void(e.removeEventListener?e.removeEventListener(t,i,!1):e.detachEvent&&e.detachEvent("on"+t,i)):console.warn("element not exists")}function n(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"div",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=document.createElement(e);for(var n in t)if(t.hasOwnProperty(n)){var r=t[n];null===r?o.removeAttribute(r):o.setAttribute(n,r)}for(var s in i)i.hasOwnProperty(s)&&(o[s]=i[s]);return o}function r(e){return document.getElementById(e)}function s(e,t){e.classList?e.classList.add(t):c(e,t)||(e.className=e.className+" "+t)}function l(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(u(t)," ")}function a(e,t,i){i?s(e,t):l(e,t)}function c(e,t){return e.classList?e.classList.contains(t):u(t).test(e.className)}function u(e){return new RegExp("(^|\\s)"+e+"($|\\s)")}function p(e){var t=void 0;if(e.getBoundingClientRect&&e.parentNode&&(t=e.getBoundingClientRect()),!t)return{left:0,top:0};var i=document.documentElement,o=document.body,n=i.clientLeft||o.clientLeft||0,r=window.pageXOffset||o.scrollLeft,s=t.left+r-n,l=i.clientTop||o.clientTop||0,a=window.pageYOffset||o.scrollTop,c=t.top+a-l;return{left:Math.round(s),top:Math.round(c)}}function h(e,t,i){var o={},n=i||p(e),r=e.offsetWidth,s=e.offsetHeight,l=n.top,a=n.left,c=t.pageY||t.clientY,u=t.pageX||t.clientX;return t.changedTouches&&(u=t.changedTouches[0].pageX,c=t.changedTouches[0].pageY),o.y=Math.max(0,Math.min(1,(l-c+s)/s)),o.x=Math.max(0,Math.min(1,(u-a)/r)),o}function d(e,t,i){var o=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=document.createElement("script");if(n.onload=n.onreadystatechange=function(){this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState||("function"==typeof t&&t(),n.onload=n.onreadystatechange=null,n.parentNode&&!o&&n.parentNode.removeChild(n))},i)for(var r in i)if(i.hasOwnProperty(r)){var s=i[r];null===s?n.removeAttribute(s):n.setAttribute(r,s)}n.src=e,document.getElementsByTagName("head")[0].appendChild(n)}function f(){var e=document,t=e.documentElement,i=e.body;return{width:t&&t.clientWidth||i&&i.offsetWidth||window.innerWidth||0,height:t&&t.clientHeight||i&&i.offsetHeight||window.innerHeight||0}}t.__esModule=!0,t.on=i,t.off=o,t.createEl=n,t.get=r,t.addClass=s,t.removeClass=l,t.toggleClass=a,t.hasClass=c,t.findElPosition=p,t.getPointerPosition=h,t.loadScript=d,t.getViewportSize=f},function(e,t,i){"use strict";function o(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t["default"]=e,t}function n(){return E++}function r(e,t,i){t.guid||(t.guid=n());var o=function(){t.apply(e,arguments)};return o.guid=i?i+"_"+t.guid:t.guid,o}function s(e){if(e instanceof Array)return 0===e.length;for(var t in e)if(e.hasOwnProperty(t))return!1;return!0}function l(e){e|=0;var t=3600,i=60,o=e/t|0,n=(e-o*t)/i|0,r=e-o*t-n*i;return o=o>0?o+":":"",n=n>0?n+":":"00:",r=r>0?r+"":o.length>0||n.length>0?"00":"00:00",o=2==o.length?"0"+o:o,n=2==n.length?"0"+n:n,r=1==r.length?"0"+r:r,o+n+r}function a(e){h.__isFullscreen=!!document[_.fullscreenElement],h.__isFullscreen||(I.IS_X5TBS&&w.off(h.player.video.el,"x5videoexitfullscreen",c),w.off(document,_.fullscreenchange,a)),M.pub({type:b.MSG.FullScreen,src:"util",ts:e.timeStamp,detail:{isFullscreen:h.__isFullscreen}},h.player)}function c(e){"x5videoexitfullscreen"===e.type&&(h.__isFullscreen=!1,w.off(document,_.fullscreenchange,a),w.off(h.player.video.el,"x5videoexitfullscreen",c),M.pub({type:b.MSG.FullScreen,src:"util",ts:e.timeStamp,detail:{isFullscreen:!1}},h.player))}function u(e){"webkitbeginfullscreen"==e.type?(w.off(h.player.video.el,"webkitbeginfullscreen",u),w.on(h.player.video.el,"webkitendfullscreen",u),M.pub({type:b.MSG.FullScreen,src:"util",ts:e.timeStamp,detail:{isFullscreen:!0}},h.player)):"webkitendfullscreen"==e.type&&(w.off(h.player.video.el,"webkitendfullscreen",u),M.pub({type:b.MSG.FullScreen,src:"util",ts:e.timeStamp,detail:{isFullscreen:!1}},h.player))}function p(e){27===e.keyCode&&h(h.player,!1)}function h(e,t,i){if("undefined"==typeof t)return h.__isFullscreen||!1;var o=e.options.systemFullscreen;h.player=e,_.requestFullscreen?t?(I.IS_X5TBS&&w.on(e.video.el,"x5videoexitfullscreen",c),w.on(document,_.fullscreenchange,a),i&&i[_.requestFullscreen]()):document[_.exitFullscreen]():o&&e.video.el.webkitEnterFullScreen?(w.on(e.video.el,"webkitbeginfullscreen",u),t?e.video.el.webkitEnterFullScreen():e.video.el.webkitExitFullscreen()):(h.__isFullscreen=t,h.__isFullscreen?(h.__origOverflow=document.documentElement.style.overflow,document.documentElement.style.overflow="hidden",w.on(document,"keydown",p)):(document.documentElement.style.overflow=h.__origOverflow,w.off(document,"keydown",p)),w.toggleClass(document.body,"vcp-full-window",t),M.pub({type:b.MSG.FullScreen,src:"util",detail:{isFullscreen:h.__isFullscreen}},h.player))}function d(e){for(var t=arguments.length,i=Array(t>1?t-1:0),o=1;ol)return-1}return-1}function A(e){return e.replace(/&/g,"&").replace(//g,">").replace(/\"/g,""").replace(/\'/g,"'").replace(/\//g,"/")}function v(e){var t="unknown";return e.isFormat("rtmp")?t="rtmp":e.isFormat("flv")?t="flv":e.isFormat("m3u8")?t="m3u8":e.isFormat("mp4")&&(t="mp4"),t}function g(e,t){e=e.replace(/^(http|https):/,"");var i=window.location.protocol;return"http:"!=i&&"https:"!=i&&(i=t||"https:"),e=i+e}t.__esModule=!0,t.supportStyle=t.console=t.VideoType=t.CDNPath=t.FullscreenApi=void 0,t.guid=n,t.bind=r,t.isEmpty=s,t.convertTime=l,t.doFullscreen=h,t.extend=d,t.store=f,t.compareVersion=y,t.escapeHTML=A,t.getFormat=v,t.unifyProtocol=g;for(var m=i(2),w=o(m),b=i(4),M=o(b),S=i(1),I=o(S),E=1,_=t.FullscreenApi={requestFullscreen:null,exitFullscreen:null,fullscreenElement:null,fullscreenEnabled:null,fullscreenchange:null,fullscreenerror:null},T=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],D=T[0],L=void 0,O=0;O10||C.IOS_VERSION>10)&&"system"==this.options.controls||(this.bigplay=new b["default"](this),this.bigplay.render(this.el));var n=void 0;n=!(this.options.controls&&"default"!=this.options.controls&&(!this.options.flash||"system"!=this.options.controls)),n&&(this.panel=new m["default"](this),this.panel.render(this.el)),this.setup()},e.prototype.verifyOptions=function(){return C.IE_VERSION&&x.compareVersion(C.IE_VERSION,"8.0")==-1?(this.errortips.show({code:5}),!1):!!this.options.src||(this.options.videoSource.hasUrl()?C.IS_IE||!C.IS_ENABLED_FLASH?this.errortips.show({code:5}):this.errortips.show({code:5}):this.errortips.show({code:12}),!1)},e.prototype.size=function(e,t,i){i=i||"cover";var o=/^\d+\.?\d{0,2}%$/,n=void 0,r=void 0;if(o.test(e)||o.test(t))n=e,r=t;else{var s=this.video?this.video.videoWidth():this.options.width,l=this.video?this.video.videoHeight():this.options.height;if(n=e,r=t,s&&l){var a=s/l;"fit"==i&&(n=e,r=n/a,r>t&&(n*=t/r,r=t))}var c=P.getViewportSize();c.width>0&&n>c.width&&(n=c.width)}n+=o.test(n)?"":"px",r+=o.test(r)?"":"px",this.el.style.width=n,this.el.style.height=r,this.video&&(this.video.width(n),this.video.height(r)),this.width=n,this.height=r},e.prototype.setup=function(){if(this.__handleEvent=x.bind(this,this.handleEvent),C.IS_MOBILE){if(this.options.autoplay){var e=this;document.addEventListener("WeixinJSBridgeReady",function(){e.play()})}}else this.loading.show()},e.prototype.destroy=function(){this.video&&this.video.destroy(),this.panel&&this.panel.destroy(),this.bigplay&&this.bigplay.destroy(),this.loading&&this.loading.destroy(),d.unsub("*","*",this.handleMsg,this),this.video=this.panel=this.bigplay=this.loading=null,this.el.parentNode.removeChild(this.el)},e.prototype.setListener=function(e){this.listener=e},e.prototype.handleEvent=function(e){switch(e.type){case"mousemove":if(this.__lastmove&&new Date-this.__lastmove<100)break;var t=this;if(this.__movecnt=this.__movecnt||0,this.__movecnt++,this.__movecnt<5){setTimeout(function(){t.__movecnt=0},500);break}this.__movecnt=0,this.__lastmove=+new Date,clearTimeout(this.__moveid),t.panel&&t.panel.show(),this.__moveid=setTimeout(function(){t.playing()&&t.panel&&t.panel.hide()},3e3)}},e.prototype.handleMsg=function(e){switch(e.type){case O.Load:P.removeClass(this.el,"vcp-playing"),("none"===this.options.preload||this.options.hlsConfig&&this.options.hlsConfig.autoStartLoad===!1)&&this.loading.hide();break;case O.Play:if(!this.playing())break;!this.hasPlay&&this.options.flash&&(this.mtaReport.reportFlash(),this.hasPlay=!0),P.addClass(this.el,"vcp-playing"),this.video.type()==x.VideoType.RTMP&&(this.__wait=!0,this.loading.show()),P.on(this.el,"mousemove",this.__handleEvent);break;case O.Playing:this.loading.hide();break;case O.TimeUpdate:this.__wait&&(this.__wait=!1,this.loading.hide());break;case O.Pause:P.off(this.el,"mousemove",this.__handleEvent),P.removeClass(this.el,"vcp-playing");break;case O.Ended:P.off(this.el,"mousemove",this.__handleEvent),this.panel&&this.panel.show(),P.removeClass(this.el,"vcp-playing");break;case O.MetaLoaded:this.loading.hide(),this.mtaReport.report(),this.size(this.options.width,this.options.height);break;case O.Seeking:this.loading.show();break;case O.Seeked:this.loading.hide();break;case O.FullScreen:var t=this;setTimeout(function(){P.toggleClass(t.el,"vcp-fullscreen",e.detail.isFullscreen)},0);break;case O.Error:this.loading.hide(),this.errortips.show(e.detail),this.panel&&this.panel.show();try{var i=this.options.videoSource,o=x.getFormat(i);C.IS_X5TBS?MtaH5.clickStat("x5_err",{format:o}):MtaH5.clickStat("error",{format:o})}catch(e){}}!e["private"]&&this.listener&&this.listener(e)},e.prototype.currentTime=function(e){return this.video.currentTime(e)},e.prototype.duration=function(){return this.video.duration()},e.prototype.percent=function(e){return this.video.duration()?"undefined"==typeof e?this.video.currentTime()/this.video.duration():void this.video.currentTime(this.video.duration()*e):0},e.prototype.buffered=function(){return this.video.duration()?this.video.buffered()/this.video.duration():0},e.prototype.pause=function(){this.video.pause()},e.prototype.play=function(){var e;this.errortips.clear(),(e=this.video).play.apply(e,arguments)},e.prototype.togglePlay=function(){this.errortips.clear(),this.video.togglePlay()},e.prototype.stop=function(){this.video.stop()},e.prototype.mute=function(e){return this.video.mute(e)},e.prototype.volume=function(e){return this.video.volume(e)},e.prototype.fullscreen=function(e){return this.video.fullscreen(e)},e.prototype.load=function(e,t){this.errortips.clear(),this.loading.show(),this.video.load(e||this.options.src,t)},e.prototype.playing=function(){return this.video&&this.video.playing()},e.prototype.paused=function(){return this.video&&this.video.paused()},e}()},function(e,t,i){var o=i(7);"string"==typeof o&&(o=[[e.id,o,""]]);i(22)(o,{});o.locals&&(e.exports=o.locals)},function(e,t,i){t=e.exports=i(8)(),t.push([e.id,".vcp-player{position:relative;z-index:0;font-family:Tahoma,\\\\5FAE\\8F6F\\96C5\\9ED1,\\u5b8b\\u4f53,Verdana,Arial,sans-serif;background-color:#000}.vcp-player video{display:block;overflow:hidden}.vcp-fullscreen.vcp-player,.vcp-fullscreen video,body.vcp-full-window{width:100%!important;height:100%!important}body.vcp-full-window{overflow-y:auto}.vcp-full-window .vcp-player{position:fixed;left:0;top:0;z-index:2147483647}.vcp-pre-flash,.vcp-video{width:100%;height:100%}.vcp-pre-flash{z-index:999;background:#000;position:absolute;top:0;left:0}.vcp-controls-panel{position:absolute;bottom:0;width:100%;font-size:16px;height:3em;z-index:1000}.vcp-controls-panel.show{animation:fadeIn ease .8s;animation-fill-mode:forwards;-webkit-animation-fill-mode:forwards}.vcp-controls-panel.hide{animation:fadeOut ease .8s;animation-fill-mode:forwards;-webkit-animation-fill-mode:forwards}.vcp-panel-bg{width:100%;height:100%;position:absolute;left:0;top:0;background-color:#242424;opacity:.8;filter:alpha(opacity=80);z-index:1000}.vcp-playtoggle{cursor:pointer;position:relative;z-index:1001;width:3em;height:100%;float:left;background-image:url("+i(9)+");background-image:url("+i(10)+")\\0}.vcp-playtoggle:focus,.vcp-playtoggle:hover{background-color:#708090;opacity:.9;filter:alpha(opacity=90)}.touchable .vcp-playtoggle:hover{background-color:transparent;opacity:1}.vcp-playing .vcp-playtoggle{background-image:url("+i(11)+");background-image:url("+i(12)+")\\0}.vcp-bigplay{width:100%;height:80%;position:absolute;background-color:white\\0;filter:alpha(opacity=0);opacity:0;z-index:1000;top:0;left:0}.vcp-slider{position:relative;z-index:1001;float:left;background:#c4c4c4;height:10px;opacity:.8;filter:alpha(opacity=80);cursor:pointer}.vcp-slider .vcp-slider-track{width:0;height:100%;margin-top:0;opacity:1;filter:alpha(opacity=100);background-color:#1e90ff}.vcp-slider .vcp-slider-thumb{cursor:pointer;background-color:#fff;position:absolute;top:0;left:0;border-radius:1em!important;height:10px;margin-left:-5px;width:10px}.vcp-slider-vertical{position:relative;width:.5em;height:8em;top:-5.6em;z-index:1001;background-color:#1c1c1c;opacity:.9;filter:alpha(opacity=90);cursor:pointer}.vcp-slider-vertical .vcp-slider-track{background-color:#1275cf;width:.5em;height:100%;opacity:.8;filter:alpha(opacity=80)}.vcp-slider-vertical .vcp-slider-thumb{cursor:pointer;position:absolute;background-color:#f0f8ff;width:.8em;height:.8em;border-radius:.8em!important;margin-top:-.4em;top:0;left:-.15em}.vcp-timeline{top:-10px;left:0;height:10px;position:absolute;z-index:1001;width:100%}.vcp-timeline .vcp-slider-thumb{top:-4px}.vcp-timeline .vcp-slider{margin-top:8px;height:2px;width:100%}.vcp-timeline:hover .vcp-slider{margin-top:0;height:10px}.vcp-timeline:hover .vcp-slider-thumb{display:block;width:16px;height:16px;top:-3px;margin-left:-8px}.vcp-timelabel{display:inline-block;line-height:3em;float:left;color:#fff;padding:0 9px}.vcp-timelabel,.vcp-volume{height:3em;z-index:1001;position:relative}.vcp-volume{width:3em;cursor:pointer;float:right;background-color:transparent;opacity:.9;filter:alpha(opacity=90)}.vcp-volume-icon{background-image:url("+i(13)+");background-image:url("+i(14)+")\\0;display:inline-block;width:3em;height:3em;position:absolute;left:0;top:0}.vcp-volume-muted .vcp-volume-icon{background-image:url("+i(15)+");background-image:url("+i(16)+")\\0}.vcp-volume .vcp-slider-vertical{top:-8.4em;left:1em;display:none}.vcp-volume .vcp-slider-track{position:absolute;bottom:0}.vcp-volume:hover .vcp-slider-vertical{display:block}.vcp-volume .vcp-volume-bg{height:8.8em;width:2em;position:absolute;left:.25em;top:-8.8em;background:#242424;display:none}.vcp-volume:hover .vcp-slider-vertical,.vcp-volume:hover .vcp-volume-bg{display:block}.vcp-fullscreen-toggle{position:relative;width:3em;height:3em;float:right;cursor:pointer;z-index:1001;background-image:url("+i(17)+");background-image:url("+i(18)+")\\0}.vcp-fullscreen .vcp-fullscreen-toggle{background-image:url("+i(19)+");background-image:url("+i(20)+')\\0}.vcp-loading{box-sizing:border-box;background-clip:padding-box;width:50px;height:50px;display:none;position:absolute;top:50%;left:50%;margin:-25px 0 0 -25px;text-indent:-9999em}.vcp-loading:before{box-sizing:inherit;content:"";display:block;width:100%;height:100%;border-radius:50%;border:3px solid hsla(0,0%,100%,0);border-left-color:#fff;border-right-color:#fff;transform:translateZ(0);animation:load8 1.1s infinite linear}@keyframes load8{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.vcp-poster{position:absolute;left:0;top:0;overflow:hidden;z-index:1000;width:100%;height:100%;display:none}.vcp-poster-pic{position:relative}.vcp-poster-pic.cover,.vcp-poster-pic.default{left:50%;top:50%;transform:translate(-50%,-50%)}.vcp-poster-pic.cover{width:100%}.vcp-poster-pic.stretch{width:100%;height:100%}.vcp-error-tips{position:absolute;z-index:1001;width:100%;height:4.5em;left:0;top:50%;color:#ff4500;margin-top:-5.25em;text-align:center;display:none}.vcp-clarityswitcher{height:3em;width:3em;cursor:pointer;position:relative;z-index:1001;float:right;background-color:transparent;opacity:.9}.vcp-vertical-switcher-container{width:3em;position:absolute;left:0;bottom:2.4em;background:#242424;display:none}.vcp-vertical-switcher-current{display:block;color:#fff;text-align:center;line-height:3em}.vcp-vertical-switcher-item{display:block;color:#fff;text-align:center;line-height:2em}.vcp-vertical-switcher-item.current{color:#888}.vcp-share>a{width:3em;height:3em;cursor:pointer;background-image:url('+i(21)+");opacity:.9;display:block}.vcp-share{width:3em;height:3em;position:relative;float:right;z-index:1001}.vcp-vertical-share-container{width:auto;height:auto;position:absolute;background:rgba(36,36,36,.8);padding:.5em;overflow:hidden;display:none}@keyframes fadeOut{0%{opacity:1}to{opacity:0}}.fadeOut{animation:fadeOut ease .8s;animation-fill-mode:forwards;-webkit-animation-fill-mode:forwards}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}.fadeIn{animation:fadeIn ease .8s;animation-fill-mode:forwards;-webkit-animation-fill-mode:forwards}",""])},function(e,t){e.exports=function(){var e=[];return e.toString=function(){for(var e=[],t=0;t=0&&m.splice(t,1)}function l(e){var t=document.createElement("style");return t.type="text/css",r(e,t),t}function a(e){var t=document.createElement("link");return t.rel="stylesheet",r(e,t),t}function c(e,t){var i,o,n;if(t.singleton){var r=g++;i=v||(v=l(t)),o=u.bind(null,i,r,!1),n=u.bind(null,i,r,!0)}else e.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(i=a(t),o=h.bind(null,i),n=function(){s(i),i.href&&URL.revokeObjectURL(i.href)}):(i=l(t),o=p.bind(null,i),n=function(){s(i)});return o(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;o(e=t)}else n()}}function u(e,t,i,o){var n=i?"":o.css;if(e.styleSheet)e.styleSheet.cssText=w(t,n);else{var r=document.createTextNode(n),s=e.childNodes;s[t]&&e.removeChild(s[t]),s.length?e.insertBefore(r,s[t]):e.appendChild(r)}}function p(e,t){var i=t.css,o=t.media;if(o&&e.setAttribute("media",o),e.styleSheet)e.styleSheet.cssText=i;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(i))}}function h(e,t){var i=t.css,o=t.sourceMap;o&&(i+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(o))))+" */");var n=new Blob([i],{type:"text/css"}),r=e.href;e.href=URL.createObjectURL(n),r&&URL.revokeObjectURL(r)}var d={},f=function(e){var t;return function(){return"undefined"==typeof t&&(t=e.apply(this,arguments)),t}},y=f(function(){return/msie [6-9]\b/.test(self.navigator.userAgent.toLowerCase())}),A=f(function(){return document.head||document.getElementsByTagName("head")[0]}),v=null,g=0,m=[];e.exports=function(e,t){t=t||{},"undefined"==typeof t.singleton&&(t.singleton=y()),"undefined"==typeof t.insertAt&&(t.insertAt="bottom");var i=n(e);return o(i,t),function(e){for(var r=[],s=0;s0?f.console.error("加载视频文件超时"):f.console.error("无法加载视频文件,请检查网络,以及视频文件是否允许跨域请求访问,m3u8文件是否存在 "+(t.response&&t.response.status?"netstatus:"+t.response.status:"")),this.notify({type:"error",code:2,timeStamp:+new Date}),r.startLoad();break;case Hls.ErrorTypes.MEDIA_ERROR:r.recoverMediaError();break;default:r.destroy()}},t.prototype.__flvLoaded=function(e){if(!flvjs.isSupported())return this.notify({type:"error",code:5,timeStamp:+new Date});this.flv&&this.flv.destroy();var t=flvjs.createPlayer({type:"flv",isLive:this.player.options.live,url:e},this.options.flvConfig);t.attachMediaElement(this.el),t.on(flvjs.Events.ERROR,f.bind(this,function(e,t,i){var o={type:"error"};e==flvjs.ErrorTypes.NETWORK_ERROR&&(o.code=2),e==flvjs.ErrorTypes.MEDIA_ERROR&&(o.code=1002),e==flvjs.ErrorTypes.OTHER_ERROR,o.timeStamp=+new Date,this.notify(o)})),t.on(flvjs.Events.MEDIA_INFO,f.bind(this,function(e,t){})),t.on(flvjs.Events.STATISTICS_INFO,f.bind(this,function(e,t){})),this.flv=t,t.load()},t.prototype.setup=function(){this.playState=v.PlayStates.IDLE,this.seekState=v.SeekStates.IDLE,this.metaDataLoaded=!1,this.__timebase=+new Date,this.on(y.MSG.MetaLoaded,this.notify),this.on(y.MSG.Loaded,this.notify),this.on(y.MSG.Progress,this.notify),this.on(y.MSG.Play,this.notify),this.on(y.MSG.Playing,this.notify),this.on(y.MSG.Pause,this.notify),this.on(y.MSG.Error,this.notify),this.on(y.MSG.TimeUpdate,this.notify),this.on(y.MSG.Ended,this.notify),this.on(y.MSG.Seeking,this.notify),this.on(y.MSG.Seeked,this.notify),this.on(y.MSG.VolumeChange,this.notify),this.on("durationchange",this.notify),this.load(this.options.src,this.options.m3u8?f.VideoType.M3U8:"")},t.prototype.destroy=function(){e.prototype.destroy.call(this),this.hls&&this.hls.destroy(),this.flv&&this.flv.destroy()},t.prototype.notify=function(e){var t={type:e.type,src:this,ts:+new Date,timeStamp:e.timeStamp};switch(e.type){case y.MSG.MetaLoaded:this.metaDataLoaded=!0;break;case y.MSG.Error:var i={1:"MEDIA_ERR_ABORTED",2:"MEDIA_ERR_NETWORK",3:"MEDIA_ERR_DECODE",4:"MEDIA_ERR_SRC_NOT_SUPPORTED"};t.detail=this.el&&this.el.error||{code:e.code},t.detail.reason=i[t.detail.code];break;case y.MSG.Ended:this.pause(),this.playState=v.PlayStates.STOP;break;case"durationchange":0!=this.videoHeight()&&(t.type=y.MSG.Resize);break;case y.MSG.Playing:this.playState=e.type.toUpperCase();break;case y.MSG.Pause:this.playState=v.PlayStates.PAUSED;break;case y.MSG.Seeking:case y.MSG.Seeked:this.seekState=e.type.toUpperCase()}"timeupdate"!=e.type,this.pub(t)},t.prototype.videoWidth=function(){return this.el.videoWidth},t.prototype.videoHeight=function(){return this.el.videoHeight},t.prototype.width=function(e){return e?void(this.el.style.width=e):this.el.width},t.prototype.height=function(e){return e?void(this.el.style.height=e):this.el.height},t.prototype.play=function(){this.options.hlsConfig&&this.options.hlsConfig.autoStartLoad===!1&&this.hls&&this.hls.startLoad(-1),this.el.play()},t.prototype.togglePlay=function(){this.paused()?this.play():this.pause()},t.prototype.pause=function(){this.el.pause()},t.prototype.stop=function(){this.el.pause(),this.el.currentTime=0},t.prototype.paused=function(){return this.el.paused},t.prototype.buffered=function(){return this.el.buffered.length>=1?this.el.buffered.end(this.el.buffered.length-1):0},t.prototype.currentTime=function(e){return"undefined"==typeof e?this.el.currentTime:this.el.currentTime=e},t.prototype.duration=function(){return this.el.duration||0},t.prototype.mute=function(e){return"undefined"==typeof e?this.el.muted:(this.volume(e?0:this.__lastVol),this.el.muted=e)},t.prototype.volume=function(e){return"undefined"==typeof e?this.el.volume:(e<0&&(e=0),e>1&&(e=1),0!=e&&(this.__lastVol=e),this.el.muted=0==e,this.options.volume=e,this.el.volume=e)},t.prototype.fullscreen=function(e){return f.doFullscreen(this.player,e,this.owner)},t.prototype.load=function(e,t){this.pub({type:y.MSG.Load,src:this,ts:+new Date,detail:{src:e,type:t}});var i=e.indexOf(".m3u8")>-1||t==f.VideoType.M3U8,o=e.indexOf(".flv")>-1;if(!m.IS_ENABLED_MSE||!i&&!o||m.IS_X5TBS&&this.player.options.x5_player||i&&m.IS_MAC&&m.IS_SAFARI&&!m.IS_IOS)this.__type=t,this.el.src=e;else{var n=this,r=w[this.options.hls]||w["0.7.1"];i?(this.__type=f.VideoType.M3U8,"undefined"==typeof window.Hls?h.loadScript(f.unifyProtocol(f.CDNPath+r),function(){n.__hlsLoaded.call(n,e)}):this.__hlsLoaded(e)):o&&(this.__type=f.VideoType.FLV,"undefined"==typeof window.flvjs?h.loadScript(f.unifyProtocol(f.CDNPath+"libs/flv.min.1.5.js"),function(){n.__flvLoaded.call(n,e)}):this.__flvLoaded(e))}},t.prototype.playing=function(){return!this.el.paused},t.prototype.type=function(){return this.__type},t}(u["default"]);t["default"]=b},function(e,t,i){"use strict";function o(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t["default"]=e,t}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){return t+"_"+e}function s(e,t){return t.guid&&String(t.guid).indexOf("_")==-1?e+"_"+t.guid:t.guid}t.__esModule=!0;var l=i(2),a=o(l),c=i(3),u=o(c),p=i(4),h=o(p),d=i(1),f=o(d),y=function(){function e(t,i){n(this,e),this.name=i,this.player=t,this.options=t.options,this.fnCache={},this.guid=u.guid()}return e.prototype.createEl=function(e,t,i){return this.el=a.createEl(e,t,i)},e.prototype.render=function(e){return e&&this.el&&(this.owner=e,e.appendChild(this.el),this.setup()),this.el},e.prototype.on=function(e,t,i){"string"==typeof e&&(i=t,t=e,e=this.el),this.cbs=this.cbs||{};var o=s(this.guid,i),n=!o,l=o&&!this.fnCache[o];return n||l?(i=u.bind(this,i,this.guid),this.fnCache[i.guid]=i,o=i.guid):i=this.fnCache[o],a.on(e,t,i),this.cbs[r(o,t)]={guid:o,el:e,type:t},i},e.prototype.off=function(e,t,i){"string"==typeof e&&(i=t,t=e,e=this.el),f.IS_MOBILE&&"click"==t&&(t="touchend");var o=s(this.guid,i);this.fnCache[o]&&(i=this.fnCache[o]),a.off(e,t,i),delete this.cbs[r(o,t)]},e.prototype.pub=function(e){var t=this;setTimeout(function(){h.pub(e,t.player)},0)},e.prototype.sub=function(e,t,i){h.sub(e,t,i,this.player)},e.prototype.unsub=function(e,t,i){h.unsub(e,t,i,this.player)},e.prototype.handleMsg=function(){},e.prototype.setup=function(){},e.prototype.destroy=function(){if(this.handleMsg&&this.unsub("*","*",this.handleMsg),this.cbs){for(var e in this.cbs)if(this.cbs.hasOwnProperty(e)){var t=this.cbs[e];a.off(t.el,t.type,this.fnCache[t.guid]),delete this.cbs[e]}this.fnCache=null,this.cbs=null;try{this.el.parentNode.removeChild(this.el)}catch(e){}}},e}();t["default"]=y},function(e,t){"use strict";t.__esModule=!0;t.PlayStates={IDLE:"IDLE",PLAYING:"PLAYING",PAUSED:"PAUSED",STOP:"STOP"},t.SeekStates={IDLE:"IDLE",SEEKING:"SEEKING",SEEKED:"SEEKED"},t.ControlsStates={DEFAULT:"default",NONE:"none",SYSTEM:""}},function(e,t,i){"use strict";function o(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t["default"]=e,t}function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function a(e){return window.document[e]?window.document[e]:navigator.appName.indexOf("Microsoft Internet")!=-1?document.getElementById(e):document.embeds&&document.embeds[e]?document.embeds[e]:void 0}t.__esModule=!0;var c=i(24),u=n(c),p=i(4),h=i(2),d=o(h),f=i(3),y=o(f),A=i(25),v=o(A),g=i(1),m=o(g),w=function(e){function t(i){r(this,t);var o=s(this,e.call(this,i,"FlashVideo")),n="vcpFlashCB_"+o.guid;return o.__flashCB=n,window[n]||(window[n]=function(e,t){t=t&&t[0];var i=window[n].fnObj&&window[n].fnObj[t.objectID];i&&i(e,t)},window[n].fnObj={}),o}return l(t,e),t.prototype.render=function(e){this.__timebase=+new Date;var t=this.player.options,i=y.unifyProtocol(t.flashUrl||"//imgcache.qq.com/open/qcloud/video/player/release/QCPlayer.swf"),o="opaque",n="obj_vcplayer_"+this.player.guid,r=this.__flashCB;this.__id=n;var s=d.createEl("div",{class:"vcp-video"});s.innerHTML='\n\t\t\n \n \n \n \n \n \n \n \n\n \n \n \n\t\t',this.container=s,this.owner=e,this.owner.appendChild(s),this.cover=d.createEl("div",{class:"vcp-pre-flash"}),this.owner.appendChild(this.cover),window[this.__flashCB].fnObj[this.__id]=y.bind(this,this.notify)},t.prototype.setup=function(){this.on("error",this.notify),this.playState=v.PlayStates.IDLE,this.seekState=v.SeekStates.IDLE,this.metaDataLoaded=!1},t.prototype.doPolling=function(){this.options.live||(clearInterval(this.__timer),this.__timer=setInterval(this.interval.bind(this),1e3))},t.prototype.endPolling=function(){clearInterval(this.__timer)},t.prototype.interval=function(){var e;try{e=this.el.getState()}catch(e){return void this.endPolling()}if(this.__m3u8){var t=this.currentTime()+e.bufferLength;this.__buffered!==t&&(this.__buffered=t,this.pub({type:p.MSG.Progress,src:this,ts:+new Date})),this.__buffered>=this.duration()&&this.endPolling()}else this.__rtmp||(this.__bytesloaded!=e.bytesLoaded&&(this.__bytesloaded=e.bytesLoaded, +this.pub({type:p.MSG.Progress,src:this,ts:+new Date})),this.__bytesloaded>=this.__bytesTotal&&this.endPolling())},t.prototype.destroy=function(){"undefined"!=typeof this.el&&"undefined"!=typeof this.el.destroy&&this.el.destroy(),this.endPolling(),delete window[this.__flashCB].fnObj[this.__id],e.prototype.destroy.call(this)},t.prototype.notify=function(e,t){var i={type:e,ts:+new Date};try{switch(this.options.debug&&this.pub({type:i.type,src:this,ts:i.ts,detail:y.extend({debug:!0},t)}),i.type){case"ready":if(this.el=a(this.__id),this.setup(),m.IS_FIREFOX){var o=this;setTimeout(function(){o.el.setAutoPlay(!!o.options.autoplay),o.__timebase=new Date-t.time,o.load(o.options.src)},0)}else{try{this.el.setAutoPlay(!!this.options.autoplay)}catch(e){console.warn("Flash 调用失败,请检查Flash是否启用成功")}this.__timebase=new Date-t.time,this.load(this.options.src)}return;case"metaData":i.type=p.MSG.MetaLoaded,this.__videoWidth=t.videoWidth,this.__videoHeight=t.videoHeight,this.__duration=t.duration,this.__bytesTotal=t.bytesTotal,this.__prevPlayState=null,this.__m3u8=t.type===y.VideoType.M3U8,this.__rtmp=t.type===y.VideoType.RTMP,this.__type=t.type,this.__metaloaded=!0,this.metaDataLoaded=!0,this.doPolling();var o=this;if(!o.cover)break;setTimeout(function(){o.cover&&(o.owner.removeChild(o.cover),o.cover=null)},500);break;case"playState":this.playState=t.playState,t.playState==v.PlayStates.PLAYING?(this.__playing=!0,this.__stopped=!1,i.type=p.MSG.Play):t.playState==v.PlayStates.PAUSED?(this.__playing=!1,this.__stopped=!1,i.type=p.MSG.Pause):t.playState==v.PlayStates.STOP?(this.__playing=!1,this.__stopped=!0,i.type=p.MSG.Ended,this.__prevPlayState=null,this.options.live&&(this.metaDataLoaded=!1)):t.playState==v.PlayStates.IDLE&&(this.__playing=!1,this.__stopped=!0,i.type=p.MSG.Ended);break;case"seekState":if(this.seekState=t.seekState,!this.__metaloaded)return;if(t.seekState==v.SeekStates.SEEKING)i.type=p.MSG.Seeking;else{if(t.seekState!=v.SeekStates.SEEKED)return;this.__m3u8||this.options.live||t.playState!=v.PlayStates.STOP||(this.play(),this.__prevPlayState=t.playState),this.__m3u8&&(i.type=p.MSG.Seeked)}break;case"netStatus":this.options.live||("NetStream.Buffer.Full"==t.code?(this.__prevPlayState==v.PlayStates.PAUSED||this.__prevPlayState==v.PlayStates.STOP,this.__prevPlayState=null,i.type=p.MSG.Seeked):"NetStream.Seek.Complete"==t.code),"NetConnection.Connect.Closed"==t.code&&(this.options.src.indexOf("rtmp://")>-1?this.playState==v.PlayStates.STOP?(i.type="error",t={code:13,reason:t.code}):(i.type="error",t={code:1002,reason:t.code}):this.playState=v.PlayStates.IDLE),"NetStream.Play.Stop"!=t.code&&"NetConnection.Connect.Success"!=t.code&&"NetConnection.Connect.Failed"!=t.code||(this.playState=v.PlayStates.IDLE);break;case"mediaTime":this.__videoWidth=t.videoWidth,this.__videoHeight=t.videoHeight,i.type=p.MSG.TimeUpdate;break;case"error":if("NetStream.Seek.InvalidTime"==t.code)return this.currentTime(t.details),!1;"NetStream.Play.StreamNotFound"==t.code&&this.pub({type:"netStatus",src:this,ts:i.ts,detail:t});var n=isNaN(parseInt(t.code))?1002:t.code,r=isNaN(parseInt(t.code))?t.code:t.msg,s=r.match(/#(\d+)/);s&&s[1]&&(n=s[1]),t={code:n,reason:r||""},this.metaDataLoaded=!1}var l="printLog"==e||"canPlay"==e;!l&&this.pub({type:i.type,src:this,ts:i.ts,detail:t})}catch(t){y.console.error(e+" "+i.type,t)}},t.prototype.handleMsg=function(e){},t.prototype.videoWidth=function(){return this.__videoWidth},t.prototype.videoHeight=function(){return this.__videoHeight},t.prototype.width=function(e){return"undefined"==typeof e?this.el&&this.el.width:(e="100%",this.el&&(this.el.width=e))},t.prototype.height=function(e){return"undefined"==typeof e?this.el&&this.el.height:(e="100%",this.el&&(this.el.height=e))},t.prototype.play=function(e){this.playState==v.PlayStates.PAUSED||this.playState==v.PlayStates.PLAYING||e?this.el.playerResume():this.playState!=v.PlayStates.PLAYING&&this.el.playerPlay()},t.prototype.togglePlay=function(){if(this.metaDataLoaded)if(this.playState==v.PlayStates.PAUSED)this.el.playerResume();else if(this.playState==v.PlayStates.PLAYING)this.el.playerPause();else if(this.playState==v.PlayStates.STOP)this.currentTime(0),this.el.playerResume();else try{this.el.playerPlay()}catch(e){console.warn("Flash 调用失败,请检查Flash是否启用成功")}else this.player.load()},t.prototype.pause=function(){this.el.playerPause()},t.prototype.stop=function(){this.el.playerStop()},t.prototype.paused=function(){return!this.__playing},t.prototype.buffered=function(){var e;return this.__m3u8?this.__buffered||0:(e=(this.__bytesloaded||0)/(this.__bytesTotal||1),this.duration()*e)},t.prototype.currentTime=function(e){return"undefined"==typeof e?this.el.getPosition():void this.el.playerSeek(e)},t.prototype.duration=function(){return this.__duration},t.prototype.mute=function(e){return"undefined"==typeof e?0==this.volume():void this.volume(e?0:this.__lastVol)},t.prototype.volume=function(e){return"undefined"==typeof e?this.el&&this.el.getState().volume:(this.el&&this.el.playerVolume(e),0!=e&&(this.__lastVol=e),this.options.volume=e,void this.pub({type:p.MSG.VolumeChange,src:this,ts:+new Date}))},t.prototype.fullscreen=function(e){return y.doFullscreen(this.player,e,this.owner)},t.prototype.load=function(e,t){this.pub({type:p.MSG.Load,src:this,ts:+new Date,detail:{src:e,type:t}}),this.el&&this.el.playerLoad(e)},t.prototype.playing=function(){return this.el&&this.el.getState&&this.el.getState().playState===v.PlayStates.PLAYING},t.prototype.type=function(){return this.__type},t.prototype.state=function(){return this.playState},t}(u["default"]);t["default"]=w},function(e,t,i){"use strict";function o(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t["default"]=e,t}function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=i(24),c=n(a),u=i(28),p=n(u),h=i(29),d=n(h),f=i(30),y=i(31),A=n(y),v=i(32),g=n(v),m=i(33),w=n(m),b=i(34),M=n(b),S=i(4),I=i(2),E=o(I),_=i(3),T=o(_),D=i(1),L=o(D),O=function(e){function t(i){return r(this,t),s(this,e.call(this,i,"Panel"))}return l(t,e),t.prototype.render=function(t){return this.createEl("div",{class:"vcp-controls-panel"}),this.el.appendChild(E.createEl("div",{class:"vcp-panel-bg"})),this.playToggle=new p["default"](this.player),this.playToggle.render(this.el),this.timelabel=new g["default"](this.player),this.timelabel.render(this.el),this.timeline=new A["default"](this.player),this.timeline.render(this.el),this.options.fullscreenEnabled===!0&&(this.fullscreen=new d["default"](this.player),this.fullscreen.render(this.el)),L.IS_MOBILE||(this.volume=new w["default"](this.player),this.volume.render(this.el)),this.options.videoSource&&this.options.videoSource.definitions.length>1&&!L.IS_MOBILE&&(this.claritySwitcher=new M["default"](this.player),this.claritySwitcher.render(this.el)),e.prototype.render.call(this,t)},t.prototype.setup=function(){var e=T.bind(this,this.handleMsg);this.sub(f.MSG.Changing,this.volume,e),this.sub(f.MSG.Changed,this.timeline.progress,e),this.sub(S.MSG.TimeUpdate,this.player.video,e),this.sub(S.MSG.Progress,this.player.video,e),this.sub(S.MSG.MetaLoaded,this.player.video,e),this.sub(S.MSG.Pause,this.player.video,e),this.sub(S.MSG.Play,this.player.video,e),this.sub(S.MSG.Ended,this.player.video,e)},t.prototype.handleMsg=function(e){switch(e.type){case S.MSG.MetaLoaded:this.timeline.percent(this.player.percent()),this.timeline.buffered(this.player.buffered()),this.player.volume("undefined"==typeof this.options.volume?.5:this.options.volume),!this.options.autoplay&&this.show();break;case S.MSG.TimeUpdate:this.timeline.scrubbing||this.timeline.percent(this.player.percent());break;case S.MSG.Pause:this.show();break;case S.MSG.Play:this.hide();break;case S.MSG.Progress:this.timeline.buffered(this.player.buffered());break;case f.MSG.Changed:e.src===this.timeline.progress&&this.player.percent(this.timeline.percent());break;case S.MSG.Ended:this.show()}},t.prototype.toggle=function(){E.hasClass(this.el,"show")?this.hide():this.show()},t.prototype.show=function(){E.hasClass(this.el,"hide")&&(E.removeClass(this.el,"hide"),E.addClass(this.el,"show"))},t.prototype.hide=function(){E.removeClass(this.el,"show"),E.addClass(this.el,"hide")},t}(c["default"]);t["default"]=O},function(e,t,i){"use strict";function o(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t["default"]=e,t}function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=i(24),c=n(a),u=i(2),p=(o(u),i(4)),h=(o(p),i(3)),d=(o(h),i(25)),f=(o(d),function(e){function t(i){return r(this,t),s(this,e.call(this,i,"PlayToggle"))}return l(t,e),t.prototype.render=function(t){return this.createEl("div",{class:"vcp-playtoggle"}),e.prototype.render.call(this,t)},t.prototype.setup=function(){this.on("click",this.onClick)},t.prototype.onClick=function(){this.player.togglePlay()},t.prototype.handleMsg=function(e){console.log("@"+this.name,e)},t}(c["default"]));t["default"]=f},function(e,t,i){"use strict";function o(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t["default"]=e,t}function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=i(24),c=n(a),u=i(2),p=(o(u),i(4)),h=(o(p),i(3)),d=o(h),f=function(e){function t(i){return r(this,t),s(this,e.call(this,i,"FullscreenToggle"))}return l(t,e),t.prototype.render=function(t){return this.createEl("div",{class:"vcp-fullscreen-toggle"}),window.fsApi=d.FullscreenApi,e.prototype.render.call(this,t)},t.prototype.setup=function(){this.on("click",this.onClick)},t.prototype.onClick=function(){this.player.fullscreen(!this.player.fullscreen())},t.prototype.handleMsg=function(e){console.log(t.name,e)},t}(c["default"]);t["default"]=f},function(e,t,i){"use strict";function o(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t["default"]=e,t}function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0,t.MSG=void 0;var a=i(24),c=n(a),u=i(2),p=o(u),h=i(4),d=(o(h),i(3)),f=(o(d),t.MSG={Changing:"sliderchanging",Changed:"sliderchanged"}),y=function(e){function t(i,o){r(this,t);var n=s(this,e.call(this,i,"Slider"));return n.vertical=o||!1,n}return l(t,e),t.prototype.render=function(t,i){var o=this.vertical?"vcp-slider-vertical":"vcp-slider";return this.createEl("div",{class:o}),this.track=p.createEl("div",{class:"vcp-slider-track"}),this.thumb=p.createEl("div",{class:"vcp-slider-thumb"}),this.el.appendChild(this.track),this.el.appendChild(this.thumb),this.enabled="undefined"==typeof i||i,e.prototype.render.call(this,t)},t.prototype.setup=function(){this.enabled&&(this.ownerDoc=document.body.ownerDocument,this.on("mousedown",this.mousedown),this.on("touchstart",this.mousedown))},t.prototype.handleMsg=function(e){},t.prototype.mousedown=function(e){return e.preventDefault&&e.preventDefault(),this.pos=p.findElPosition(this.el),this.on(this.ownerDoc,"mouseup",this.mouseup),this.on(this.ownerDoc,"mousemove",this.mousemove),this.on(this.ownerDoc,"touchend",this.mouseup),this.on(this.ownerDoc,"touchmove",this.mousemove),this.mousemove(e),!1},t.prototype.mouseup=function(e){e.target||e.srcElement;this.off(this.ownerDoc,"mouseup",this.mouseup),this.off(this.ownerDoc,"mousemove",this.mousemove),this.off(this.ownerDoc,"touchend",this.mouseup),this.off(this.ownerDoc,"touchmove",this.mousemove),this.pub({type:f.Changed,src:this,private:!0})},t.prototype.mousemove=function(e){var t=p.getPointerPosition(this.el,e,this.pos);this.vertical?(this.__percent=1-t.y,this.thumb.style.top=100*this.__percent+"%"):(this.__percent=t.x,this.thumb.style.left=100*this.__percent+"%"),this.__percent=Number(this.__percent.toFixed(3)),this.pub({type:f.Changing,src:this,private:!0})},t.prototype.percent=function(e){return e||0==e?(this.__percent=e,void(this.vertical?this.thumb.style.top=100*this.__percent+"%":this.thumb.style.left=100*this.__percent+"%")):this.__percent},t}(c["default"]);t["default"]=y},function(e,t,i){"use strict";function o(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t["default"]=e,t}function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=i(30),c=n(a),u=i(24),p=n(u),h=i(2),d=(o(h),i(3)),f=o(d),y=function(e){function t(i){return r(this,t),s(this,e.call(this,i,"Timeline"))}return l(t,e),t.prototype.render=function(t){return this.enabled=!this.options.live,this.createEl("div",{class:"vcp-timeline"}),this.progress=new c["default"](this.player,!1),this.progress.render(this.el,this.enabled),this.track=this.progress.track,this.enabled||(this.el.style.display="none"),e.prototype.render.call(this,t)},t.prototype.setup=function(){this.enabled&&(this.sub(a.MSG.Changing,this.progress,f.bind(this,this.handleMsg)),this.sub(a.MSG.Changed,this.progress,f.bind(this,this.handleMsg)))},t.prototype.handleMsg=function(e){e.type===a.MSG.Changing?(this.scrubbing=!0,this.syncLabel(this.percent())):e.type===a.MSG.Changed&&(this.scrubbing=!1)},t.prototype.syncLabel=function(e){var t=this.player.duration();e=Math.min(e,1);var i="";t&&(i=f.convertTime(e*t)+" / "+f.convertTime(t)),this.pub({type:"timelabel",src:"timeline",label:i,private:!0})},t.prototype.buffered=function(e){this.enabled&&(e=Math.min(e,1),this.__buffered=e,this.track.style.width=100*e+"%")},t.prototype.percent=function(e){if(this.enabled)return"undefined"==typeof e?this.progress.percent()||0:(e=Math.min(e,1),this.syncLabel(e),this.__buffered0&&this.__muted&&this.syncMute(!1)}},t.prototype.toggleMute=function(e){var t=!this.player.mute();this.player.mute(t)},t.prototype.syncMute=function(e){e?d.addClass(this.el,"vcp-volume-muted"):d.removeClass(this.el,"vcp-volume-muted"),this.__muted=e},t.prototype.syncTrack=function(e){this.track.style.height=100*e+"%",this.volume.percent(1-e)},t.prototype.percent=function(e){return"undefined"==typeof e?1-this.volume.percent()||0:(this.player.volume(e),e)},t}(p["default"]);t["default"]=v},function(e,t,i){"use strict";function o(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t["default"]=e,t}function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=i(24),c=n(a),u=i(2),p=o(u),h=i(3),d=o(h),f={od:"超清",hd:"高清",sd:"标清"},y=function(e){function t(i){r(this,t);var o=s(this,e.call(this,i,"ClaritySwitcher"));return f=d.extend({},i.options.clarityLabel,f),i.claritySwitcher=o,o}return l(t,e),t.prototype.render=function(t){this.show=!1,this.createEl("div",{class:"vcp-clarityswitcher"}),this.current=p.createEl("a",{class:"vcp-vertical-switcher-current"}),this.container=p.createEl("div",{class:"vcp-vertical-switcher-container"}),this.items=[],this.currentItem="";var i=this.options.videoSource;this.current.innerHTML=f[i.curDef],this.el.appendChild(this.current);for(var o=0;o10||A.IOS_VERSION>10)&&"system"==this.player.options.controls&&this.player.togglePlay()},t.prototype.handleMsg=function(e){switch(e.type){case v.MSG.Load:this.__loaded=!1,this.setPoster(this.poster.start);break;case v.MSG.MetaLoaded:if(this.__loaded=!0,!this.player.playing())break;this.hide();case v.MSG.Play:if(!this.__loaded)break;this.hide();break;case v.MSG.Pause:if(!this.__loaded)break;this.options.pausePosterEnabled===!0&&this.setPoster(this.poster.pause);break;case v.MSG.Ended:if(!this.__loaded)break;break;case v.MSG.Error:if(!this.__loaded)break}},t.prototype.setPoster=function(e){if(e=e||this.poster.src){this.__preload&&(this.__preload.onload=null),this.__preload=new Image;var t=this.__preload;this.hide();var i=this;t.onload=function(){if(i.pic.src!==t.src&&(i.pic.src=t.src,i.show(),!f.supportStyle("transform"))){var e="stretch"==i.poster.style;if(e)return;var o="cover"==i.poster.style?i.options.width/(t.width/t.height):t.height,n="-"+i.options.width/2+"px",r="-"+o/2+"px";i.pic.style.cssText="left: 50%; top: 50%; margin-left: "+n+"; margin-top: "+r+";"}},t.src=e}},t.prototype.toggle=function(e){clearTimeout(this.__tid);var t=this;this.__tid=setTimeout(function(){t.el.style.display=e},100)},t.prototype.hide=function(){this.__preload&&(this.__preload.onload=null),this.toggle("none")},t.prototype.show=function(){this.toggle("block")},t}(u["default"]);t["default"]=g},function(e,t,i){"use strict";function o(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t["default"]=e,t}function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=i(24),c=n(a),u=i(2),p=(o(u),i(4)),h=(o(p),i(3)),d=(o(h),function(e){function t(i){r(this,t);var o=s(this,e.call(this,i,"Loading"));return o.timeSeed=null,o}return l(t,e),t.prototype.render=function(t){return this.createEl("div",{class:"vcp-loading"}),e.prototype.render.call(this,t)},t.prototype.setup=function(){},t.prototype.handleMsg=function(e){},t.prototype.show=function(){if(this.options.showLoading!==!1){var e=500,t=this;this.timeSeed=setTimeout(function(){t.el.style.display="block"},e)}},t.prototype.hide=function(){this.timeSeed&&(clearTimeout(this.timeSeed),this.timeSeed=null),this.el.style.display="none"},t}(c["default"]));t["default"]=d},function(e,t,i){"use strict";function o(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t["default"]=e,t}function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var a=i(24),c=n(a),u=i(2),p=(o(u),i(4)),h=(o(p),i(3)),d=o(h),f={EnvError:"当前系统环境不支持播放该视频格式",EnvFlashError:"当前系统环境不支持播放该视频格式",VideoSourceError:"获取视频失败,请检查播放链接是否有效",NetworkError:"网络错误,请检查网络配置或者播放链接是否正确",VideoDecodeError:"视频解码错误",ArgumentError:"使用参数有误,请检查播放器调用代码",UrlEmpty:"请填写视频播放地址",FileProtocol:"请勿在file协议下使用播放器,可能会导致视频无法播放",LiveFinish:"直播已结束,请稍后再来",CrossDomainError:"无法加载视频文件,跨域访问被拒绝",Ie9IframeFullscreenError:"在IE9中用iframe引用的实例无法支持全屏"},y={FileProtocol:[10],ArgumentError:[11],UrlEmpty:[12],LiveFinish:[13],VideoSourceError:[1002,2032],EnvError:[4,5],NetworkError:[1001,1,2],VideoDecodeError:[3],CrossDomainError:[2048],Ie9IframeFullscreenError:[10001]},A=function(e){function t(i){r(this,t);var o=s(this,e.call(this,i,"ErrorTips"));o.customTips=d.extend({},f,o.options.wording);for(var n in y)for(var l=0;l { + return Math.ceil(Date.now() / 1000) +} + +export const formatPrice = (number) => { + number = parseFloat(number) + return '¥' + number.toFixed(2) +} + +export const formatNumber = (number) => { + number = number.toString() + return number[1] ? number : '0' + number +} + +export const formatDuration = (number) => { + let result = '00:00' + if (number > 0) { + let hours = Math.floor(number / 3600) + let minutes = Math.floor((number - hours * 3600) / 60) + let seconds = number % 60 + let format = [] + if (hours > 0) { + format.push(formatNumber(hours)) + } + if (minutes > 0) { + format.push(formatNumber(minutes)) + } + if (seconds >= 0) { + format.push(formatNumber(seconds)) + } + return format.join(':') + } + return result +} + +export const thumbAvatar = (url) => { + return `${url}!avatar_160` +} + +export const thumbCover = (url) => { + return `${url}!cover_270` +} + +export const thumbSlide = (url) => { + return `${url}!slide_1100` +} + +export const orderStatus = (status) => { + const mapping = { + '1': '待支付', + '2': '发货中', + '3': '已完成', + '4': '已关闭', + '5': '已退款', + } + return mapping[status] ? mapping[status] : '未知' +} + +export const refundStatus = (status) => { + const mapping = { + '1': '待处理', + '2': '已取消', + '3': '退款中', + '4': '已拒绝', + '5': '已完成', + '6': '已失败', + } + return mapping[status] ? mapping[status] : '未知' +} + +export const courseLevel = (level) => { + const mapping = { + '1': '入门', + '2': '初级', + '3': '中级', + '4': '高级', + } + return mapping[level] ? mapping[level] : '未知' +} + +export const redirect = (url, params = {}) => { + const tabUrls = [ + '/pages/index/index', + '/pages/course/category', + '/pages/discovery/index', + '/pages/me/index', + '/pages/im/index', + ] + if (Object.keys(params).length > 0) { + url += '?' + httpBuildQuery(params) + } + if (tabUrls.indexOf(url) !== -1) { + uni.switchTab({ + url: url + }) + } else if (url.indexOf('://') !== -1) { + plus.runtime.openURL(url) + } else if (url.indexOf('/pages') == 0) { + uni.navigateTo({ + url: url + }) + } else { + uni.showToast({ + title: '不支持的协议类型' + }) + } +} + +export const getPlatform = () => { + let platform = 'OTHER' + // #ifdef H5 + platform = 'H5' + // #endif + // #ifdef MP-WEIXIN + platform = 'MP_WEIXIN' + // #endif + // #ifdef MP-ALIPAY + platform = 'MP_ALIPAY' + // #endif + // #ifdef MP-TOUTIAO + platform = 'MP_TOUTIAO' + // #endif + // #ifdef APP-PLUS + platform = uni.getSystemInfoSync().platform + // #endif + return platform.toLowerCase() +} + +const httpBuildQuery = (params) => { + let result = '' + if (Object.keys(params).length > 0) { + let arr = [] + for (let key in params) { + arr.push(`${key}=${params[key]}`) + } + result = arr.sort().join('&') + } + return result +} + +export const getApiBaseUrl = () => { + return Config.apiBaseUrl +} + +export const getToken = () => { + let key = Storage.cacheKey.token + return Storage.get(key) +} + +export const setToken = (value) => { + let key = Storage.cacheKey.token + return Storage.set(key, value) +} + +export const clearToken = (value) => { + let key = Storage.cacheKey.token + return Storage.set(key, '') +} + +export const isLogin = () => { + if (getToken() == '') { + return false + } + return true +} + +export const checkLogin = (opt = {}) => { + let redirect = '/pages/index/index' + if (opt.redirect && opt.redirect != '') { + redirect = opt.redirect + } + if (getToken() == '') { + uni.navigateTo({ + url: '/pages/account/login?redirect=' + encodeURIComponent(redirect) + }) + return false + } + if (opt.success && typeof opt.success == 'function') { + opt.success() + } +} diff --git a/components/consult-list.vue b/components/consult-list.vue new file mode 100644 index 0000000000000000000000000000000000000000..66960cc649961bf24fcfcfe3adf0618ff4c9b5aa --- /dev/null +++ b/components/consult-list.vue @@ -0,0 +1,148 @@ + + + + + diff --git a/components/course-chapter-list.vue b/components/course-chapter-list.vue new file mode 100644 index 0000000000000000000000000000000000000000..4b186ff49b4e22f40bef5959f552b8a1e4cf312e --- /dev/null +++ b/components/course-chapter-list.vue @@ -0,0 +1,107 @@ + + + + + diff --git a/components/course-list.vue b/components/course-list.vue new file mode 100644 index 0000000000000000000000000000000000000000..2487784f621196c7a2fbeaa4482df52d62ea199c --- /dev/null +++ b/components/course-list.vue @@ -0,0 +1,101 @@ + + + + + diff --git a/components/course-package-list.vue b/components/course-package-list.vue new file mode 100644 index 0000000000000000000000000000000000000000..a26def55c051d1f7b48295cec06ad724d1c01c54 --- /dev/null +++ b/components/course-package-list.vue @@ -0,0 +1,129 @@ + + + + + diff --git a/components/course-teacher-list.vue b/components/course-teacher-list.vue new file mode 100644 index 0000000000000000000000000000000000000000..8ab5076d4943fa19210e0d57cc7602ce7bc3bc84 --- /dev/null +++ b/components/course-teacher-list.vue @@ -0,0 +1,83 @@ + + + + + diff --git a/components/group-list.vue b/components/group-list.vue new file mode 100644 index 0000000000000000000000000000000000000000..c4d1606b7daefa53c5105e70fe2bb30094930e93 --- /dev/null +++ b/components/group-list.vue @@ -0,0 +1,76 @@ + + + + + diff --git a/components/live-list.vue b/components/live-list.vue new file mode 100644 index 0000000000000000000000000000000000000000..e7869bccc2adafb05c154728f2b6d6ae4ff21e6d --- /dev/null +++ b/components/live-list.vue @@ -0,0 +1,78 @@ + + + + + diff --git a/components/review-list.vue b/components/review-list.vue new file mode 100644 index 0000000000000000000000000000000000000000..8d8e0f3849f4753b2769a10894e6c7742d25ac49 --- /dev/null +++ b/components/review-list.vue @@ -0,0 +1,143 @@ + + + + + diff --git a/components/teacher-list.vue b/components/teacher-list.vue new file mode 100644 index 0000000000000000000000000000000000000000..4e2778632d8ca6812a217b61326f07b7ac188ae2 --- /dev/null +++ b/components/teacher-list.vue @@ -0,0 +1,84 @@ + + + + + diff --git a/components/user-course-list.vue b/components/user-course-list.vue new file mode 100644 index 0000000000000000000000000000000000000000..3b51f14dba63351f4d3babfef3ce02fc349d3268 --- /dev/null +++ b/components/user-course-list.vue @@ -0,0 +1,89 @@ + + + + + diff --git a/components/user-friend-list.vue b/components/user-friend-list.vue new file mode 100644 index 0000000000000000000000000000000000000000..cbeacb82dbfb7c5acb04954c15a1514e459bd85a --- /dev/null +++ b/components/user-friend-list.vue @@ -0,0 +1,84 @@ + + + + + diff --git a/components/user-group-list.vue b/components/user-group-list.vue new file mode 100644 index 0000000000000000000000000000000000000000..bea51e7ff14d6fd817998e3e115a5f336f62de34 --- /dev/null +++ b/components/user-group-list.vue @@ -0,0 +1,77 @@ + + + + + diff --git a/components/user-list.vue b/components/user-list.vue new file mode 100644 index 0000000000000000000000000000000000000000..4e96f9324d38e35306d229ff480ceb9980c7c5ff --- /dev/null +++ b/components/user-list.vue @@ -0,0 +1,83 @@ + + + + + diff --git a/main.js b/main.js new file mode 100644 index 0000000000000000000000000000000000000000..6e0e3e65ca49c521b272c8d94cdd6e49a165623f --- /dev/null +++ b/main.js @@ -0,0 +1,53 @@ +import Vue from 'vue' +import App from './App' +import * as Utils from '@/common/utils.js' +import * as Api from '@/common/api.js' + +Vue.prototype.$utils = Utils +Vue.prototype.$api = Api + +Vue.config.productionTip = false + +Vue.filter('formatPrice', function(argv) { + return Utils.formatPrice(argv) +}) + +Vue.filter('formatDuration', function(argv) { + return Utils.formatDuration(argv) +}) + +Vue.filter('thumbAvatar', function(argv) { + return Utils.thumbAvatar(argv) +}) + +Vue.filter('thumbCover', function(argv) { + return Utils.thumbCover(argv) +}) + +Vue.filter('thumbSlide', function(argv) { + return Common.thumbSlide(argv) +}) + +Vue.filter('courseLevel', function(argv) { + return Utils.courseLevel(argv) +}) + +Vue.filter('orderStatus', function(argv) { + return Utils.orderStatus(argv) +}) + +Vue.filter('refundStatus', function(argv) { + return Utils.refundStatus(argv) +}) + +App.mpType = 'app' + +import uView from 'uview-ui' + +Vue.use(uView) + +const app = new Vue({ + ...App +}) + +app.$mount() diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..2bd0d7490965816833017541023c219bb73ee776 --- /dev/null +++ b/manifest.json @@ -0,0 +1,96 @@ +{ + "name" : "ctc-app", + "appid" : "__UNI__CC01E6A", + "description" : "", + "versionName" : "1.0.0", + "versionCode" : "100", + "transformPx" : false, + /* 5+App特有相关 */ + "app-plus" : { + "usingComponents" : true, + "nvueCompiler" : "uni-app", + "compilerVersion" : 3, + "splashscreen" : { + "alwaysShowBeforeRender" : true, + "waiting" : true, + "autoclose" : true, + "delay" : 0 + }, + /* 模块配置 */ + "modules" : {}, + /* 应用发布信息 */ + "distribute" : { + /* android打包配置 */ + "android" : { + "permissions" : [ + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ] + }, + /* ios打包配置 */ + "ios" : {}, + /* SDK配置 */ + "sdkConfigs" : {} + } + }, + /* 快应用特有相关 */ + "quickapp" : {}, + /* 小程序特有相关 */ + "mp-weixin" : { + "appid" : "wx0e0b1bf59e2c7166", + "setting" : { + "urlCheck" : false + }, + "usingComponents" : true + }, + "mp-alipay" : { + "usingComponents" : true + }, + "mp-baidu" : { + "usingComponents" : true + }, + "mp-toutiao" : { + "usingComponents" : true + }, + "uniStatistics" : { + "enable" : false + }, + "h5" : { + "title" : "酷瓜云课堂", + "optimization" : { + "treeShaking" : { + "enable" : true + } + }, + "router" : { + "base" : "/h5/", + "mode" : "hash" + }, + "sdkConfigs" : { + "maps" : {} + }, + "publicPath" : "https://course-1255691183.file.myqcloud.com/static/h5", + "template" : "template.h5.html", + "domain" : "ctc.koogua.com" + } +} diff --git a/pages.json b/pages.json new file mode 100644 index 0000000000000000000000000000000000000000..8b415905d8613af12aaa9bc8070d36020b274a8e --- /dev/null +++ b/pages.json @@ -0,0 +1,289 @@ +{ + "easycom": { + "^u-(.*)": "@/uview-ui/components/u-$1/u-$1.vue" + }, + "pages": [{ + "path": "pages/index/index", + "style": { + "navigationBarTitleText": "酷瓜云课堂" + } + }, { + "path": "pages/search/index", + "style": { + "navigationBarTitleText": "内容搜索" + } + }, { + "path": "pages/discovery/index", + "style": { + "navigationBarTitleText": "精彩发现" + } + }, { + "path": "pages/course/category", + "style": { + "navigationBarTitleText": "课程分类" + } + }, { + "path": "pages/course/list", + "style": { + "navigationBarTitleText": "课程列表" + } + }, { + "path": "pages/course/info", + "style": { + "navigationBarTitleText": "课程详情" + } + }, { + "path": "pages/course/consults", + "style": { + "navigationBarTitleText": "课程咨询" + } + }, { + "path": "pages/course/reviews", + "style": { + "navigationBarTitleText": "课程评价" + } + }, { + "path": "pages/chapter/vod", + "style": { + "navigationBarTitleText": "课时详情" + } + }, { + "path": "pages/chapter/live", + "style": { + "navigationBarTitleText": "课时详情" + } + }, { + "path": "pages/chapter/read", + "style": { + "navigationBarTitleText": "课时详情" + } + }, { + "path": "pages/teacher/list", + "style": { + "navigationBarTitleText": "教师列表" + } + }, { + "path": "pages/teacher/index", + "style": { + "navigationBarTitleText": "教师主页" + } + }, { + "path": "pages/teacher/courses", + "style": { + "navigationBarTitleText": "课程列表" + } + }, { + "path": "pages/im/group/list", + "style": { + "navigationBarTitleText": "群组列表" + } + }, { + "path": "pages/im/group/index", + "style": { + "navigationBarTitleText": "群组主页" + } + }, { + "path": "pages/review/info", + "style": { + "navigationBarTitleText": "评价详情" + } + }, { + "path": "pages/review/add", + "style": { + "navigationBarTitleText": "发布评价" + } + }, { + "path": "pages/review/edit", + "style": { + "navigationBarTitleText": "修改评价" + } + }, { + "path": "pages/consult/info", + "style": { + "navigationBarTitleText": "咨询详情" + } + }, { + "path": "pages/consult/add", + "style": { + "navigationBarTitleText": "提交咨询" + } + }, { + "path": "pages/consult/edit", + "style": { + "navigationBarTitleText": "修改咨询" + } + }, { + "path": "pages/live/list", + "style": { + "navigationBarTitleText": "直播列表" + } + }, { + "path": "pages/help/index", + "style": { + "navigationBarTitleText": "帮助中心" + } + }, { + "path": "pages/help/info", + "style": { + "navigationBarTitleText": "帮助详情" + } + }, { + "path": "pages/page/info", + "style": { + "navigationBarTitleText": "单页详情" + } + }, { + "path": "pages/user/index", + "style": { + "navigationBarTitleText": "用户主页" + } + }, { + "path": "pages/user/courses", + "style": { + "navigationBarTitleText": "TA的课程" + } + }, { + "path": "pages/user/friends", + "style": { + "navigationBarTitleText": "TA的好友" + } + }, { + "path": "pages/user/groups", + "style": { + "navigationBarTitleText": "TA的群组" + } + }, { + "path": "pages/me/index", + "style": { + "navigationBarTitleText": "我的主页" + } + }, { + "path": "pages/me/courses", + "style": { + "navigationBarTitleText": "我的课程" + } + }, { + "path": "pages/me/favorites", + "style": { + "navigationBarTitleText": "我的收藏" + } + }, { + "path": "pages/me/consults", + "style": { + "navigationBarTitleText": "我的咨询" + } + }, { + "path": "pages/me/reviews", + "style": { + "navigationBarTitleText": "我的评价" + } + }, { + "path": "pages/me/friends", + "style": { + "navigationBarTitleText": "我的好友" + } + }, { + "path": "pages/me/groups", + "style": { + "navigationBarTitleText": "我的群组" + } + }, { + "path": "pages/me/orders", + "style": { + "navigationBarTitleText": "我的订单" + } + }, { + "path": "pages/me/refunds", + "style": { + "navigationBarTitleText": "我的退款" + } + }, { + "path": "pages/me/profile", + "style": { + "navigationBarTitleText": "资料信息" + } + }, { + "path": "pages/me/account", + "style": { + "navigationBarTitleText": "账户信息" + } + }, { + "path": "pages/account/login", + "style": { + "navigationBarTitleText": "用户登录" + } + }, { + "path": "pages/account/register", + "style": { + "navigationBarTitleText": "用户注册" + } + }, { + "path": "pages/account/forget", + "style": { + "navigationBarTitleText": "忘记密码" + } + }, { + "path": "pages/vip/index", + "style": { + "navigationBarTitleText": "会员中心" + } + }, { + "path": "pages/order/confirm", + "style": { + "navigationBarTitleText": "确认订单" + } + }, { + "path": "pages/order/pay", + "style": { + "navigationBarTitleText": "支付订单" + } + }, { + "path": "pages/order/info", + "style": { + "navigationBarTitleText": "订单详情" + } + }, { + "path": "pages/trade/h5pay", + "style": { + "navigationBarTitleText": "H5支付" + } + }, { + "path": "pages/refund/confirm", + "style": { + "navigationBarTitleText": "确认退款" + } + }, { + "path": "pages/refund/info", + "style": { + "navigationBarTitleText": "退款详情" + } + }], + "tabBar": { + "list": [{ + "pagePath": "pages/index/index", + "text": "首页" + }, + { + "pagePath": "pages/course/category", + "text": "分类" + }, + { + "pagePath": "pages/discovery/index", + "text": "发现" + }, + { + "pagePath": "pages/me/index", + "text": "我的" + } + ], + "backgroundColor": "#ffffff", + "color": "#888888", + "selectedColor": "#1aad19" + }, + "globalStyle": { + "navigationBarTextStyle": "black", + "navigationBarTitleText": "uni-app", + "navigationBarBackgroundColor": "#F8F8F8", + "backgroundColor": "#F8F8F8" + } +} diff --git a/pages/account/forget.vue b/pages/account/forget.vue new file mode 100644 index 0000000000000000000000000000000000000000..3d0edfb1c6c1a4fe93dfb868b1cd6ecd0ae24a6e --- /dev/null +++ b/pages/account/forget.vue @@ -0,0 +1,142 @@ + + + + + diff --git a/pages/account/login.vue b/pages/account/login.vue new file mode 100644 index 0000000000000000000000000000000000000000..f26e200148e9b535201d995aa96494e6924ea627 --- /dev/null +++ b/pages/account/login.vue @@ -0,0 +1,190 @@ + + + + + diff --git a/pages/account/register.vue b/pages/account/register.vue new file mode 100644 index 0000000000000000000000000000000000000000..1a190d46d108a33f00902fd7d2a93585ae0b34df --- /dev/null +++ b/pages/account/register.vue @@ -0,0 +1,146 @@ + + + + + diff --git a/pages/chapter/live.vue b/pages/chapter/live.vue new file mode 100644 index 0000000000000000000000000000000000000000..ea3f6b97e0126c008eb098fa84a2ecd5dfd9e610 --- /dev/null +++ b/pages/chapter/live.vue @@ -0,0 +1,324 @@ + + + + + diff --git a/pages/chapter/read.vue b/pages/chapter/read.vue new file mode 100644 index 0000000000000000000000000000000000000000..d273e8c64b3ead8851c70b2d89c409be09930874 --- /dev/null +++ b/pages/chapter/read.vue @@ -0,0 +1,168 @@ + + + + + diff --git a/pages/chapter/vod.vue b/pages/chapter/vod.vue new file mode 100644 index 0000000000000000000000000000000000000000..12e93210c7448d4dee59c2363d49b971b1d52ff5 --- /dev/null +++ b/pages/chapter/vod.vue @@ -0,0 +1,322 @@ + + + + + diff --git a/pages/consult/add.vue b/pages/consult/add.vue new file mode 100644 index 0000000000000000000000000000000000000000..b8cc9eac99282240fea5d2378645f72028892383 --- /dev/null +++ b/pages/consult/add.vue @@ -0,0 +1,91 @@ + + + + + diff --git a/pages/consult/edit.vue b/pages/consult/edit.vue new file mode 100644 index 0000000000000000000000000000000000000000..2fa9c869c5dfc4bbb050d25d78772fc42840cf81 --- /dev/null +++ b/pages/consult/edit.vue @@ -0,0 +1,76 @@ + + + + + diff --git a/pages/consult/info.vue b/pages/consult/info.vue new file mode 100644 index 0000000000000000000000000000000000000000..887134a71cc47de3d19d61f3537d7012a40fc568 --- /dev/null +++ b/pages/consult/info.vue @@ -0,0 +1,71 @@ + + + + + diff --git a/pages/course/category.vue b/pages/course/category.vue new file mode 100644 index 0000000000000000000000000000000000000000..05e05b7a3d51a3cb4285e0fedc5dde684a93025e --- /dev/null +++ b/pages/course/category.vue @@ -0,0 +1,59 @@ + + + + + diff --git a/pages/course/consults.vue b/pages/course/consults.vue new file mode 100644 index 0000000000000000000000000000000000000000..bd63436f6a7664b804f94df7d88bb7dcc2faec68 --- /dev/null +++ b/pages/course/consults.vue @@ -0,0 +1,65 @@ + + + + + diff --git a/pages/course/info.vue b/pages/course/info.vue new file mode 100644 index 0000000000000000000000000000000000000000..f6cb526fe74d4845ce611f2c0e91077e342a1dac --- /dev/null +++ b/pages/course/info.vue @@ -0,0 +1,406 @@ + + + + + diff --git a/pages/course/list.vue b/pages/course/list.vue new file mode 100644 index 0000000000000000000000000000000000000000..a906807b74765ea034ed9369e3f255ef69d3ca3c --- /dev/null +++ b/pages/course/list.vue @@ -0,0 +1,167 @@ + + + + + diff --git a/pages/course/reviews.vue b/pages/course/reviews.vue new file mode 100644 index 0000000000000000000000000000000000000000..57bde1f0ed7f08cccd8acfc1a543994b92cd5d92 --- /dev/null +++ b/pages/course/reviews.vue @@ -0,0 +1,65 @@ + + + + + diff --git a/pages/discovery/index.vue b/pages/discovery/index.vue new file mode 100644 index 0000000000000000000000000000000000000000..c83a17a775e3fb998b2924a26b82ae887b902606 --- /dev/null +++ b/pages/discovery/index.vue @@ -0,0 +1,117 @@ + + + + + diff --git a/pages/help/index.vue b/pages/help/index.vue new file mode 100644 index 0000000000000000000000000000000000000000..b5113b9156b48857e386d642ca3bac522a334db1 --- /dev/null +++ b/pages/help/index.vue @@ -0,0 +1,55 @@ + + + + + diff --git a/pages/help/info.vue b/pages/help/info.vue new file mode 100644 index 0000000000000000000000000000000000000000..c5294100ed29c1178465e744a847c7ff92b108ff --- /dev/null +++ b/pages/help/info.vue @@ -0,0 +1,41 @@ + + + + + diff --git a/pages/im/group/index.vue b/pages/im/group/index.vue new file mode 100644 index 0000000000000000000000000000000000000000..860b759d43ee21c6c56b69b4160cd27b5c3fe4bf --- /dev/null +++ b/pages/im/group/index.vue @@ -0,0 +1,91 @@ + + + + + diff --git a/pages/im/group/list.vue b/pages/im/group/list.vue new file mode 100644 index 0000000000000000000000000000000000000000..d8d1c2cc5533c7895e4d0ca107983f35740c84ee --- /dev/null +++ b/pages/im/group/list.vue @@ -0,0 +1,64 @@ + + + + + diff --git a/pages/index/index.vue b/pages/index/index.vue new file mode 100644 index 0000000000000000000000000000000000000000..7f29a9aaea27e522ec4b86a63f9209d759b8a174 --- /dev/null +++ b/pages/index/index.vue @@ -0,0 +1,142 @@ + + + + + diff --git a/pages/live/list.vue b/pages/live/list.vue new file mode 100644 index 0000000000000000000000000000000000000000..dd5cd22d710ebed4b86810400c096e846de466c8 --- /dev/null +++ b/pages/live/list.vue @@ -0,0 +1,64 @@ + + + + + diff --git a/pages/me/account.vue b/pages/me/account.vue new file mode 100644 index 0000000000000000000000000000000000000000..8183fd03b9597f36e5f89f93ec46c70d5d082208 --- /dev/null +++ b/pages/me/account.vue @@ -0,0 +1,22 @@ + + + + + diff --git a/pages/me/consults.vue b/pages/me/consults.vue new file mode 100644 index 0000000000000000000000000000000000000000..00cce8154a1da592dde6f4ddf8cfd77a90660731 --- /dev/null +++ b/pages/me/consults.vue @@ -0,0 +1,142 @@ + + + + + diff --git a/pages/me/courses.vue b/pages/me/courses.vue new file mode 100644 index 0000000000000000000000000000000000000000..12b37097b4204d1fd1f4d71dbb7769fe5cd8f493 --- /dev/null +++ b/pages/me/courses.vue @@ -0,0 +1,142 @@ + + + + + diff --git a/pages/me/favorites.vue b/pages/me/favorites.vue new file mode 100644 index 0000000000000000000000000000000000000000..2474495b9eea9a8ef77c115889de8428c6f53e0f --- /dev/null +++ b/pages/me/favorites.vue @@ -0,0 +1,136 @@ + + + + + diff --git a/pages/me/friends.vue b/pages/me/friends.vue new file mode 100644 index 0000000000000000000000000000000000000000..8183fd03b9597f36e5f89f93ec46c70d5d082208 --- /dev/null +++ b/pages/me/friends.vue @@ -0,0 +1,22 @@ + + + + + diff --git a/pages/me/groups.vue b/pages/me/groups.vue new file mode 100644 index 0000000000000000000000000000000000000000..8183fd03b9597f36e5f89f93ec46c70d5d082208 --- /dev/null +++ b/pages/me/groups.vue @@ -0,0 +1,22 @@ + + + + + diff --git a/pages/me/index.vue b/pages/me/index.vue new file mode 100644 index 0000000000000000000000000000000000000000..50f755ed920b5ca8efbe6781ba42a582658d2371 --- /dev/null +++ b/pages/me/index.vue @@ -0,0 +1,133 @@ + + + + + diff --git a/pages/me/orders.vue b/pages/me/orders.vue new file mode 100644 index 0000000000000000000000000000000000000000..e92df29cc384b7eeecf39ad639dc83f4c6e43d1c --- /dev/null +++ b/pages/me/orders.vue @@ -0,0 +1,187 @@ + + + + + diff --git a/pages/me/profile.vue b/pages/me/profile.vue new file mode 100644 index 0000000000000000000000000000000000000000..173c2f20e0b47319290444393aca1e85c269badf --- /dev/null +++ b/pages/me/profile.vue @@ -0,0 +1,143 @@ + + + + + diff --git a/pages/me/refunds.vue b/pages/me/refunds.vue new file mode 100644 index 0000000000000000000000000000000000000000..912676fbf605f698793f1ed45e0bcfae40a50598 --- /dev/null +++ b/pages/me/refunds.vue @@ -0,0 +1,185 @@ + + + + + diff --git a/pages/me/reviews.vue b/pages/me/reviews.vue new file mode 100644 index 0000000000000000000000000000000000000000..856c5c6c26cf66c22d96dd65556f668e2db42f3d --- /dev/null +++ b/pages/me/reviews.vue @@ -0,0 +1,131 @@ + + + + + diff --git a/pages/order/confirm.vue b/pages/order/confirm.vue new file mode 100644 index 0000000000000000000000000000000000000000..72762307d1f13dc63f65fe0f2f023cf5c362acdb --- /dev/null +++ b/pages/order/confirm.vue @@ -0,0 +1,147 @@ + + + + + diff --git a/pages/order/info.vue b/pages/order/info.vue new file mode 100644 index 0000000000000000000000000000000000000000..11a387bb9e8ecb4a6ed312031b35a608c91ed183 --- /dev/null +++ b/pages/order/info.vue @@ -0,0 +1,139 @@ + + + + + diff --git a/pages/order/pay.vue b/pages/order/pay.vue new file mode 100644 index 0000000000000000000000000000000000000000..be3c96a5a1751f146a4df552e5b48fc72b4f0fc3 --- /dev/null +++ b/pages/order/pay.vue @@ -0,0 +1,130 @@ + + + + + diff --git a/pages/page/info.vue b/pages/page/info.vue new file mode 100644 index 0000000000000000000000000000000000000000..17e24275259b4512fb6ca2302bcf116c4108cc44 --- /dev/null +++ b/pages/page/info.vue @@ -0,0 +1,41 @@ + + + + + diff --git a/pages/refund/confirm.vue b/pages/refund/confirm.vue new file mode 100644 index 0000000000000000000000000000000000000000..033be4863a7f8d9a9e1e5532fbbe90fee9f75b1c --- /dev/null +++ b/pages/refund/confirm.vue @@ -0,0 +1,174 @@ + + + + + diff --git a/pages/refund/info.vue b/pages/refund/info.vue new file mode 100644 index 0000000000000000000000000000000000000000..57618a123d8f5e418795ff4cdc949c829c6edaec --- /dev/null +++ b/pages/refund/info.vue @@ -0,0 +1,75 @@ + + + + + diff --git a/pages/review/add.vue b/pages/review/add.vue new file mode 100644 index 0000000000000000000000000000000000000000..7d23a16b60dd881fdcdfb4906f6492312076ca1a --- /dev/null +++ b/pages/review/add.vue @@ -0,0 +1,94 @@ + + + + + diff --git a/pages/review/edit.vue b/pages/review/edit.vue new file mode 100644 index 0000000000000000000000000000000000000000..88456711c615308942ce74a8a210a2b02865cb0e --- /dev/null +++ b/pages/review/edit.vue @@ -0,0 +1,93 @@ + + + + + diff --git a/pages/review/info.vue b/pages/review/info.vue new file mode 100644 index 0000000000000000000000000000000000000000..288489673f0643121869563d4fdb684497c4f48c --- /dev/null +++ b/pages/review/info.vue @@ -0,0 +1,65 @@ + + + + + diff --git a/pages/search/index.vue b/pages/search/index.vue new file mode 100644 index 0000000000000000000000000000000000000000..d040884bda5e0a930d99fb8f3d48ccbdfa1c3648 --- /dev/null +++ b/pages/search/index.vue @@ -0,0 +1,233 @@ + + + + + diff --git a/pages/teacher/courses.vue b/pages/teacher/courses.vue new file mode 100644 index 0000000000000000000000000000000000000000..0453da2fc51d31413334f905fff2168cf5fd7a35 --- /dev/null +++ b/pages/teacher/courses.vue @@ -0,0 +1,62 @@ + + + + + diff --git a/pages/teacher/index.vue b/pages/teacher/index.vue new file mode 100644 index 0000000000000000000000000000000000000000..14b575cbc67391d764e6e38e2d48281df69932b8 --- /dev/null +++ b/pages/teacher/index.vue @@ -0,0 +1,107 @@ + + + + + diff --git a/pages/teacher/list.vue b/pages/teacher/list.vue new file mode 100644 index 0000000000000000000000000000000000000000..e7917a6f97ce4fd54cd974207423de161e602d7d --- /dev/null +++ b/pages/teacher/list.vue @@ -0,0 +1,69 @@ + + + + + diff --git a/pages/trade/h5pay.vue b/pages/trade/h5pay.vue new file mode 100644 index 0000000000000000000000000000000000000000..5cc9936507350ff3e5145fcee7ce80b6e5ad043f --- /dev/null +++ b/pages/trade/h5pay.vue @@ -0,0 +1,27 @@ + + + + + diff --git a/pages/user/courses.vue b/pages/user/courses.vue new file mode 100644 index 0000000000000000000000000000000000000000..ec438080bcb603b10b554ff9fe208ba4022ac108 --- /dev/null +++ b/pages/user/courses.vue @@ -0,0 +1,65 @@ + + + + + diff --git a/pages/user/friends.vue b/pages/user/friends.vue new file mode 100644 index 0000000000000000000000000000000000000000..de7a5f2ce099e724b474cea17f5aefa6ee8e9356 --- /dev/null +++ b/pages/user/friends.vue @@ -0,0 +1,71 @@ + + + + + diff --git a/pages/user/groups.vue b/pages/user/groups.vue new file mode 100644 index 0000000000000000000000000000000000000000..c83cfb5ff152d1e0ebcfbdd61bb23aa4d298527c --- /dev/null +++ b/pages/user/groups.vue @@ -0,0 +1,69 @@ + + + + + diff --git a/pages/user/index.vue b/pages/user/index.vue new file mode 100644 index 0000000000000000000000000000000000000000..58bc10551f13dacfda02d4631169decef3ca507e --- /dev/null +++ b/pages/user/index.vue @@ -0,0 +1,179 @@ + + + + + diff --git a/pages/vip/index.vue b/pages/vip/index.vue new file mode 100644 index 0000000000000000000000000000000000000000..11e8679e916e777ce415dfbf2c147bdbe5ee0d1e --- /dev/null +++ b/pages/vip/index.vue @@ -0,0 +1,136 @@ + + + + + diff --git a/static/css/common.css b/static/css/common.css new file mode 100644 index 0000000000000000000000000000000000000000..7050063b258c57cba911d2471c86b78fe80e375a --- /dev/null +++ b/static/css/common.css @@ -0,0 +1,29 @@ +/* #ifdef H5 */ +uni-page-head { + display: none; +} +/* #endif */ + +.container { + color: #606266; + font-size: 14px; + padding: 20rpx; +} + +.form-item { + min-height: 40rpx; + margin-top: 30rpx; +} + +.form-item .link { + display: flex; + justify-content: center; +} + +.form-item .link text { + margin: 0 15rpx; +} + +.hide { + display: none; +} diff --git a/template.h5.html b/template.h5.html new file mode 100644 index 0000000000000000000000000000000000000000..bb21dc3f79ac5a8e7c32874cefbcff9edb53176a --- /dev/null +++ b/template.h5.html @@ -0,0 +1,40 @@ + + + + + + + + + + <%= htmlWebpackPlugin.options.title %> + + + + + + + + + +
+ + diff --git a/uni.scss b/uni.scss new file mode 100644 index 0000000000000000000000000000000000000000..9ecd1200d82e6c7653f0f2d2855dc4107a581991 --- /dev/null +++ b/uni.scss @@ -0,0 +1 @@ +@import 'uview-ui/theme.scss'; \ No newline at end of file diff --git a/uview-ui/LICENSE b/uview-ui/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..8e39eada86b1bcfe5b8be70399e183caa4625918 --- /dev/null +++ b/uview-ui/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 www.uviewui.com + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/uview-ui/README.md b/uview-ui/README.md new file mode 100644 index 0000000000000000000000000000000000000000..06d5676d8122fe67c33843cee361a0152d06f1b9 --- /dev/null +++ b/uview-ui/README.md @@ -0,0 +1,106 @@ +

+ logo +

+

uView

+

多平台快速开发的UI框架

+ + +## 说明 + +uView UI,是[uni-app](https://uniapp.dcloud.io/)生态优秀的UI框架,全面的组件和便捷的工具会让您信手拈来,如鱼得水 + +## 特性 + +- 兼容安卓,iOS,微信小程序,H5,QQ小程序,百度小程序,支付宝小程序,头条小程序 +- 60+精选组件,功能丰富,多端兼容,让您快速集成,开箱即用 +- 众多贴心的JS利器,让您飞镖在手,召之即来,百步穿杨 +- 众多的常用页面和布局,让您专注逻辑,事半功倍 +- 详尽的文档支持,现代化的演示效果 +- 按需引入,精简打包体积 + + +## 安装 + +```bash +# npm方式安装 +npm i uview-ui +``` + +## 快速上手 + +1. `main.js`引入uView库 +```js +// main.js +import uView from 'uview-ui'; +Vue.use(uView); +``` + +2. `App.vue`引入基础样式(注意style标签需声明scss属性支持) +```css +/* App.vue */ + +``` + +3. `uni.scss`引入全局scss变量文件 +```css +/* uni.scss */ +@import "uview-ui/theme.scss"; +``` + +4. `pages.json`配置easycom规则(按需引入) + +```js +// pages.json +{ + "easycom": { + // npm安装的方式不需要前面的"@/",下载安装的方式需要"@/" + // npm安装方式 + "^u-(.*)": "uview-ui/components/u-$1/u-$1.vue" + // 下载安装方式 + // "^u-(.*)": "@/uview-ui/components/u-$1/u-$1.vue" + }, + // 此为本身已有的内容 + "pages": [ + // ...... + ] +} +``` + +请通过[快速上手](https://uviewui.com/components/quickstart.html)了解更详细的内容 + +## 使用方法 +配置easycom规则后,自动按需引入,无需`import`组件,直接引用即可。 + +```html + +``` + +请通过[快速上手](https://uviewui.com/components/quickstart.html)了解更详细的内容 + +## 链接 + +- [官方文档](https://uviewui.com/) +- [更新日志](https://uviewui.com/components/changelog.html) +- [升级指南](https://uviewui.com/components/changelog.html) +- [关于我们](https://uviewui.com/cooperation/about.html) + +## 预览 + +您可以通过**微信**扫码,查看最佳的演示效果。 +
+
+ + + +## 版权信息 +uView遵循[MIT](https://en.wikipedia.org/wiki/MIT_License)开源协议,意味着您无需支付任何费用,也无需授权,即可将uView应用到您的产品中。 diff --git a/uview-ui/components/u-action-sheet/u-action-sheet.vue b/uview-ui/components/u-action-sheet/u-action-sheet.vue new file mode 100644 index 0000000000000000000000000000000000000000..722b668b1254c24452603e73d6ce596e97054bb7 --- /dev/null +++ b/uview-ui/components/u-action-sheet/u-action-sheet.vue @@ -0,0 +1,190 @@ + + + + + diff --git a/uview-ui/components/u-alert-tips/u-alert-tips.vue b/uview-ui/components/u-alert-tips/u-alert-tips.vue new file mode 100644 index 0000000000000000000000000000000000000000..e81fc37979e9e1a5d9c9cbbc4e1abd2a2e888eba --- /dev/null +++ b/uview-ui/components/u-alert-tips/u-alert-tips.vue @@ -0,0 +1,256 @@ + + + + + diff --git a/uview-ui/components/u-avatar-cropper/u-avatar-cropper.vue b/uview-ui/components/u-avatar-cropper/u-avatar-cropper.vue new file mode 100644 index 0000000000000000000000000000000000000000..a48dd546434c653d8b1645a2cc1840a6fe72a230 --- /dev/null +++ b/uview-ui/components/u-avatar-cropper/u-avatar-cropper.vue @@ -0,0 +1,290 @@ + + + + + diff --git a/uview-ui/components/u-avatar-cropper/weCropper.js b/uview-ui/components/u-avatar-cropper/weCropper.js new file mode 100644 index 0000000000000000000000000000000000000000..df02483861703559b7735b11e26d8ebbbff76c1a --- /dev/null +++ b/uview-ui/components/u-avatar-cropper/weCropper.js @@ -0,0 +1,1265 @@ +/** + * we-cropper v1.3.9 + * (c) 2020 dlhandsome + * @license MIT + */ +(function(global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global.WeCropper = factory()); +}(this, (function() { + 'use strict'; + + var device = void 0; + var TOUCH_STATE = ['touchstarted', 'touchmoved', 'touchended']; + + function firstLetterUpper(str) { + return str.charAt(0).toUpperCase() + str.slice(1) + } + + function setTouchState(instance) { + var arg = [], + len = arguments.length - 1; + while (len-- > 0) arg[len] = arguments[len + 1]; + + TOUCH_STATE.forEach(function(key, i) { + if (arg[i] !== undefined) { + instance[key] = arg[i]; + } + }); + } + + function validator(instance, o) { + Object.defineProperties(instance, o); + } + + function getDevice() { + if (!device) { + device = uni.getSystemInfoSync(); + } + return device + } + + var tmp = {}; + + var ref = getDevice(); + var pixelRatio = ref.pixelRatio; + + var DEFAULT = { + id: { + default: 'cropper', + get: function get() { + return tmp.id + }, + set: function set(value) { + if (typeof(value) !== 'string') { + console.error(("id:" + value + " is invalid")); + } + tmp.id = value; + } + }, + width: { + default: 750, + get: function get() { + return tmp.width + }, + set: function set(value) { + if (typeof(value) !== 'number') { + console.error(("width:" + value + " is invalid")); + } + tmp.width = value; + } + }, + height: { + default: 750, + get: function get() { + return tmp.height + }, + set: function set(value) { + if (typeof(value) !== 'number') { + console.error(("height:" + value + " is invalid")); + } + tmp.height = value; + } + }, + pixelRatio: { + default: pixelRatio, + get: function get() { + return tmp.pixelRatio + }, + set: function set(value) { + if (typeof(value) !== 'number') { + console.error(("pixelRatio:" + value + " is invalid")); + } + tmp.pixelRatio = value; + } + }, + scale: { + default: 2.5, + get: function get() { + return tmp.scale + }, + set: function set(value) { + if (typeof(value) !== 'number') { + console.error(("scale:" + value + " is invalid")); + } + tmp.scale = value; + } + }, + zoom: { + default: 5, + get: function get() { + return tmp.zoom + }, + set: function set(value) { + if (typeof(value) !== 'number') { + console.error(("zoom:" + value + " is invalid")); + } else if (value < 0 || value > 10) { + console.error("zoom should be ranged in 0 ~ 10"); + } + tmp.zoom = value; + } + }, + src: { + default: '', + get: function get() { + return tmp.src + }, + set: function set(value) { + if (typeof(value) !== 'string') { + console.error(("src:" + value + " is invalid")); + } + tmp.src = value; + } + }, + cut: { + default: {}, + get: function get() { + return tmp.cut + }, + set: function set(value) { + if (typeof(value) !== 'object') { + console.error(("cut:" + value + " is invalid")); + } + tmp.cut = value; + } + }, + boundStyle: { + default: {}, + get: function get() { + return tmp.boundStyle + }, + set: function set(value) { + if (typeof(value) !== 'object') { + console.error(("boundStyle:" + value + " is invalid")); + } + tmp.boundStyle = value; + } + }, + onReady: { + default: null, + get: function get() { + return tmp.ready + }, + set: function set(value) { + tmp.ready = value; + } + }, + onBeforeImageLoad: { + default: null, + get: function get() { + return tmp.beforeImageLoad + }, + set: function set(value) { + tmp.beforeImageLoad = value; + } + }, + onImageLoad: { + default: null, + get: function get() { + return tmp.imageLoad + }, + set: function set(value) { + tmp.imageLoad = value; + } + }, + onBeforeDraw: { + default: null, + get: function get() { + return tmp.beforeDraw + }, + set: function set(value) { + tmp.beforeDraw = value; + } + } + }; + + var ref$1 = getDevice(); + var windowWidth = ref$1.windowWidth; + + function prepare() { + var self = this; + + // v1.4.0 版本中将不再自动绑定we-cropper实例 + self.attachPage = function() { + var pages = getCurrentPages(); + // 获取到当前page上下文 + var pageContext = pages[pages.length - 1]; + // 把this依附在Page上下文的wecropper属性上,便于在page钩子函数中访问 + Object.defineProperty(pageContext, 'wecropper', { + get: function get() { + console.warn( + 'Instance will not be automatically bound to the page after v1.4.0\n\n' + + 'Please use a custom instance name instead\n\n' + + 'Example: \n' + + 'this.mycropper = new WeCropper(options)\n\n' + + '// ...\n' + + 'this.mycropper.getCropperImage()' + ); + return self + }, + configurable: true + }); + }; + + self.createCtx = function() { + var id = self.id; + var targetId = self.targetId; + + if (id) { + self.ctx = self.ctx || uni.createCanvasContext(id); + self.targetCtx = self.targetCtx || uni.createCanvasContext(targetId); + } else { + console.error("constructor: create canvas context failed, 'id' must be valuable"); + } + }; + + self.deviceRadio = windowWidth / 750; + } + + var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== + 'undefined' ? self : {}; + + + + + + function createCommonjsModule(fn, module) { + return module = { + exports: {} + }, fn(module, module.exports), module.exports; + } + + var tools = createCommonjsModule(function(module, exports) { + /** + * String type check + */ + exports.isStr = function(v) { + return typeof v === 'string'; + }; + /** + * Number type check + */ + exports.isNum = function(v) { + return typeof v === 'number'; + }; + /** + * Array type check + */ + exports.isArr = Array.isArray; + /** + * undefined type check + */ + exports.isUndef = function(v) { + return v === undefined; + }; + + exports.isTrue = function(v) { + return v === true; + }; + + exports.isFalse = function(v) { + return v === false; + }; + /** + * Function type check + */ + exports.isFunc = function(v) { + return typeof v === 'function'; + }; + /** + * Quick object check - this is primarily used to tell + * Objects from primitive values when we know the value + * is a JSON-compliant type. + */ + exports.isObj = exports.isObject = function(obj) { + return obj !== null && typeof obj === 'object' + }; + + /** + * Strict object type check. Only returns true + * for plain JavaScript objects. + */ + var _toString = Object.prototype.toString; + exports.isPlainObject = function(obj) { + return _toString.call(obj) === '[object Object]' + }; + + /** + * Check whether the object has the property. + */ + var hasOwnProperty = Object.prototype.hasOwnProperty; + exports.hasOwn = function(obj, key) { + return hasOwnProperty.call(obj, key) + }; + + /** + * Perform no operation. + * Stubbing args to make Flow happy without leaving useless transpiled code + * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/) + */ + exports.noop = function(a, b, c) {}; + + /** + * Check if val is a valid array index. + */ + exports.isValidArrayIndex = function(val) { + var n = parseFloat(String(val)); + return n >= 0 && Math.floor(n) === n && isFinite(val) + }; + }); + + var tools_7 = tools.isFunc; + var tools_10 = tools.isPlainObject; + + var EVENT_TYPE = ['ready', 'beforeImageLoad', 'beforeDraw', 'imageLoad']; + + function observer() { + var self = this; + + self.on = function(event, fn) { + if (EVENT_TYPE.indexOf(event) > -1) { + if (tools_7(fn)) { + event === 'ready' ? + fn(self) : + self[("on" + (firstLetterUpper(event)))] = fn; + } + } else { + console.error(("event: " + event + " is invalid")); + } + return self + }; + } + + function wxPromise(fn) { + return function(obj) { + var args = [], + len = arguments.length - 1; + while (len-- > 0) args[len] = arguments[len + 1]; + + if (obj === void 0) obj = {}; + return new Promise(function(resolve, reject) { + obj.success = function(res) { + resolve(res); + }; + obj.fail = function(err) { + reject(err); + }; + fn.apply(void 0, [obj].concat(args)); + }) + } + } + + function draw(ctx, reserve) { + if (reserve === void 0) reserve = false; + + return new Promise(function(resolve) { + ctx.draw(reserve, resolve); + }) + } + + var getImageInfo = wxPromise(uni.getImageInfo); + + var canvasToTempFilePath = wxPromise(uni.canvasToTempFilePath); + + var base64 = createCommonjsModule(function(module, exports) { + /*! http://mths.be/base64 v0.1.0 by @mathias | MIT license */ + (function(root) { + + // Detect free variables `exports`. + var freeExports = 'object' == 'object' && exports; + + // Detect free variable `module`. + var freeModule = 'object' == 'object' && module && + module.exports == freeExports && module; + + // Detect free variable `global`, from Node.js or Browserified code, and use + // it as `root`. + var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal; + if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) { + root = freeGlobal; + } + + /*--------------------------------------------------------------------------*/ + + var InvalidCharacterError = function(message) { + this.message = message; + }; + InvalidCharacterError.prototype = new Error; + InvalidCharacterError.prototype.name = 'InvalidCharacterError'; + + var error = function(message) { + // Note: the error messages used throughout this file match those used by + // the native `atob`/`btoa` implementation in Chromium. + throw new InvalidCharacterError(message); + }; + + var TABLE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; + // http://whatwg.org/html/common-microsyntaxes.html#space-character + var REGEX_SPACE_CHARACTERS = /[\t\n\f\r ]/g; + + // `decode` is designed to be fully compatible with `atob` as described in the + // HTML Standard. http://whatwg.org/html/webappapis.html#dom-windowbase64-atob + // The optimized base64-decoding algorithm used is based on @atk’s excellent + // implementation. https://gist.github.com/atk/1020396 + var decode = function(input) { + input = String(input) + .replace(REGEX_SPACE_CHARACTERS, ''); + var length = input.length; + if (length % 4 == 0) { + input = input.replace(/==?$/, ''); + length = input.length; + } + if ( + length % 4 == 1 || + // http://whatwg.org/C#alphanumeric-ascii-characters + /[^+a-zA-Z0-9/]/.test(input) + ) { + error( + 'Invalid character: the string to be decoded is not correctly encoded.' + ); + } + var bitCounter = 0; + var bitStorage; + var buffer; + var output = ''; + var position = -1; + while (++position < length) { + buffer = TABLE.indexOf(input.charAt(position)); + bitStorage = bitCounter % 4 ? bitStorage * 64 + buffer : buffer; + // Unless this is the first of a group of 4 characters… + if (bitCounter++ % 4) { + // …convert the first 8 bits to a single ASCII character. + output += String.fromCharCode( + 0xFF & bitStorage >> (-2 * bitCounter & 6) + ); + } + } + return output; + }; + + // `encode` is designed to be fully compatible with `btoa` as described in the + // HTML Standard: http://whatwg.org/html/webappapis.html#dom-windowbase64-btoa + var encode = function(input) { + input = String(input); + if (/[^\0-\xFF]/.test(input)) { + // Note: no need to special-case astral symbols here, as surrogates are + // matched, and the input is supposed to only contain ASCII anyway. + error( + 'The string to be encoded contains characters outside of the ' + + 'Latin1 range.' + ); + } + var padding = input.length % 3; + var output = ''; + var position = -1; + var a; + var b; + var c; + var buffer; + // Make sure any padding is handled outside of the loop. + var length = input.length - padding; + + while (++position < length) { + // Read three bytes, i.e. 24 bits. + a = input.charCodeAt(position) << 16; + b = input.charCodeAt(++position) << 8; + c = input.charCodeAt(++position); + buffer = a + b + c; + // Turn the 24 bits into four chunks of 6 bits each, and append the + // matching character for each of them to the output. + output += ( + TABLE.charAt(buffer >> 18 & 0x3F) + + TABLE.charAt(buffer >> 12 & 0x3F) + + TABLE.charAt(buffer >> 6 & 0x3F) + + TABLE.charAt(buffer & 0x3F) + ); + } + + if (padding == 2) { + a = input.charCodeAt(position) << 8; + b = input.charCodeAt(++position); + buffer = a + b; + output += ( + TABLE.charAt(buffer >> 10) + + TABLE.charAt((buffer >> 4) & 0x3F) + + TABLE.charAt((buffer << 2) & 0x3F) + + '=' + ); + } else if (padding == 1) { + buffer = input.charCodeAt(position); + output += ( + TABLE.charAt(buffer >> 2) + + TABLE.charAt((buffer << 4) & 0x3F) + + '==' + ); + } + + return output; + }; + + var base64 = { + 'encode': encode, + 'decode': decode, + 'version': '0.1.0' + }; + + // Some AMD build optimizers, like r.js, check for specific condition patterns + // like the following: + if ( + typeof undefined == 'function' && + typeof undefined.amd == 'object' && + undefined.amd + ) { + undefined(function() { + return base64; + }); + } else if (freeExports && !freeExports.nodeType) { + if (freeModule) { // in Node.js or RingoJS v0.8.0+ + freeModule.exports = base64; + } else { // in Narwhal or RingoJS v0.7.0- + for (var key in base64) { + base64.hasOwnProperty(key) && (freeExports[key] = base64[key]); + } + } + } else { // in Rhino or a web browser + root.base64 = base64; + } + + }(commonjsGlobal)); + }); + + function makeURI(strData, type) { + return 'data:' + type + ';base64,' + strData + } + + function fixType(type) { + type = type.toLowerCase().replace(/jpg/i, 'jpeg'); + var r = type.match(/png|jpeg|bmp|gif/)[0]; + return 'image/' + r + } + + function encodeData(data) { + var str = ''; + if (typeof data === 'string') { + str = data; + } else { + for (var i = 0; i < data.length; i++) { + str += String.fromCharCode(data[i]); + } + } + return base64.encode(str) + } + + /** + * 获取图像区域隐含的像素数据 + * @param canvasId canvas标识 + * @param x 将要被提取的图像数据矩形区域的左上角 x 坐标 + * @param y 将要被提取的图像数据矩形区域的左上角 y 坐标 + * @param width 将要被提取的图像数据矩形区域的宽度 + * @param height 将要被提取的图像数据矩形区域的高度 + * @param done 完成回调 + */ + function getImageData(canvasId, x, y, width, height, done) { + uni.canvasGetImageData({ + canvasId: canvasId, + x: x, + y: y, + width: width, + height: height, + success: function success(res) { + done(res, null); + }, + fail: function fail(res) { + done(null, res); + } + }); + } + + /** + * 生成bmp格式图片 + * 按照规则生成图片响应头和响应体 + * @param oData 用来描述 canvas 区域隐含的像素数据 { data, width, height } = oData + * @returns {*} base64字符串 + */ + function genBitmapImage(oData) { + // + // BITMAPFILEHEADER: http://msdn.microsoft.com/en-us/library/windows/desktop/dd183374(v=vs.85).aspx + // BITMAPINFOHEADER: http://msdn.microsoft.com/en-us/library/dd183376.aspx + // + var biWidth = oData.width; + var biHeight = oData.height; + var biSizeImage = biWidth * biHeight * 3; + var bfSize = biSizeImage + 54; // total header size = 54 bytes + + // + // typedef struct tagBITMAPFILEHEADER { + // WORD bfType; + // DWORD bfSize; + // WORD bfReserved1; + // WORD bfReserved2; + // DWORD bfOffBits; + // } BITMAPFILEHEADER; + // + var BITMAPFILEHEADER = [ + // WORD bfType -- The file type signature; must be "BM" + 0x42, 0x4D, + // DWORD bfSize -- The size, in bytes, of the bitmap file + bfSize & 0xff, bfSize >> 8 & 0xff, bfSize >> 16 & 0xff, bfSize >> 24 & 0xff, + // WORD bfReserved1 -- Reserved; must be zero + 0, 0, + // WORD bfReserved2 -- Reserved; must be zero + 0, 0, + // DWORD bfOffBits -- The offset, in bytes, from the beginning of the BITMAPFILEHEADER structure to the bitmap bits. + 54, 0, 0, 0 + ]; + + // + // typedef struct tagBITMAPINFOHEADER { + // DWORD biSize; + // LONG biWidth; + // LONG biHeight; + // WORD biPlanes; + // WORD biBitCount; + // DWORD biCompression; + // DWORD biSizeImage; + // LONG biXPelsPerMeter; + // LONG biYPelsPerMeter; + // DWORD biClrUsed; + // DWORD biClrImportant; + // } BITMAPINFOHEADER, *PBITMAPINFOHEADER; + // + var BITMAPINFOHEADER = [ + // DWORD biSize -- The number of bytes required by the structure + 40, 0, 0, 0, + // LONG biWidth -- The width of the bitmap, in pixels + biWidth & 0xff, biWidth >> 8 & 0xff, biWidth >> 16 & 0xff, biWidth >> 24 & 0xff, + // LONG biHeight -- The height of the bitmap, in pixels + biHeight & 0xff, biHeight >> 8 & 0xff, biHeight >> 16 & 0xff, biHeight >> 24 & 0xff, + // WORD biPlanes -- The number of planes for the target device. This value must be set to 1 + 1, 0, + // WORD biBitCount -- The number of bits-per-pixel, 24 bits-per-pixel -- the bitmap + // has a maximum of 2^24 colors (16777216, Truecolor) + 24, 0, + // DWORD biCompression -- The type of compression, BI_RGB (code 0) -- uncompressed + 0, 0, 0, 0, + // DWORD biSizeImage -- The size, in bytes, of the image. This may be set to zero for BI_RGB bitmaps + biSizeImage & 0xff, biSizeImage >> 8 & 0xff, biSizeImage >> 16 & 0xff, biSizeImage >> 24 & 0xff, + // LONG biXPelsPerMeter, unused + 0, 0, 0, 0, + // LONG biYPelsPerMeter, unused + 0, 0, 0, 0, + // DWORD biClrUsed, the number of color indexes of palette, unused + 0, 0, 0, 0, + // DWORD biClrImportant, unused + 0, 0, 0, 0 + ]; + + var iPadding = (4 - ((biWidth * 3) % 4)) % 4; + + var aImgData = oData.data; + + var strPixelData = ''; + var biWidth4 = biWidth << 2; + var y = biHeight; + var fromCharCode = String.fromCharCode; + + do { + var iOffsetY = biWidth4 * (y - 1); + var strPixelRow = ''; + for (var x = 0; x < biWidth; x++) { + var iOffsetX = x << 2; + strPixelRow += fromCharCode(aImgData[iOffsetY + iOffsetX + 2]) + + fromCharCode(aImgData[iOffsetY + iOffsetX + 1]) + + fromCharCode(aImgData[iOffsetY + iOffsetX]); + } + + for (var c = 0; c < iPadding; c++) { + strPixelRow += String.fromCharCode(0); + } + + strPixelData += strPixelRow; + } while (--y) + + var strEncoded = encodeData(BITMAPFILEHEADER.concat(BITMAPINFOHEADER)) + encodeData(strPixelData); + + return strEncoded + } + + /** + * 转换为图片base64 + * @param canvasId canvas标识 + * @param x 将要被提取的图像数据矩形区域的左上角 x 坐标 + * @param y 将要被提取的图像数据矩形区域的左上角 y 坐标 + * @param width 将要被提取的图像数据矩形区域的宽度 + * @param height 将要被提取的图像数据矩形区域的高度 + * @param type 转换图片类型 + * @param done 完成回调 + */ + function convertToImage(canvasId, x, y, width, height, type, done) { + if (done === void 0) done = function() {}; + + if (type === undefined) { + type = 'png'; + } + type = fixType(type); + if (/bmp/.test(type)) { + getImageData(canvasId, x, y, width, height, function(data, err) { + var strData = genBitmapImage(data); + tools_7(done) && done(makeURI(strData, 'image/' + type), err); + }); + } else { + console.error('暂不支持生成\'' + type + '\'类型的base64图片'); + } + } + + var CanvasToBase64 = { + convertToImage: convertToImage, + // convertToPNG: function (width, height, done) { + // return convertToImage(width, height, 'png', done) + // }, + // convertToJPEG: function (width, height, done) { + // return convertToImage(width, height, 'jpeg', done) + // }, + // convertToGIF: function (width, height, done) { + // return convertToImage(width, height, 'gif', done) + // }, + convertToBMP: function(ref, done) { + if (ref === void 0) ref = {}; + var canvasId = ref.canvasId; + var x = ref.x; + var y = ref.y; + var width = ref.width; + var height = ref.height; + if (done === void 0) done = function() {}; + + return convertToImage(canvasId, x, y, width, height, 'bmp', done) + } + }; + + function methods() { + var self = this; + + var boundWidth = self.width; // 裁剪框默认宽度,即整个画布宽度 + var boundHeight = self.height; // 裁剪框默认高度,即整个画布高度 + + var id = self.id; + var targetId = self.targetId; + var pixelRatio = self.pixelRatio; + + var ref = self.cut; + var x = ref.x; + if (x === void 0) x = 0; + var y = ref.y; + if (y === void 0) y = 0; + var width = ref.width; + if (width === void 0) width = boundWidth; + var height = ref.height; + if (height === void 0) height = boundHeight; + + self.updateCanvas = function(done) { + if (self.croperTarget) { + // 画布绘制图片 + self.ctx.drawImage( + self.croperTarget, + self.imgLeft, + self.imgTop, + self.scaleWidth, + self.scaleHeight + ); + } + tools_7(self.onBeforeDraw) && self.onBeforeDraw(self.ctx, self); + + self.setBoundStyle(self.boundStyle); // 设置边界样式 + + self.ctx.draw(false, done); + return self + }; + + self.pushOrigin = self.pushOrign = function(src) { + self.src = src; + + tools_7(self.onBeforeImageLoad) && self.onBeforeImageLoad(self.ctx, self); + + return getImageInfo({ + src: src + }) + .then(function(res) { + var innerAspectRadio = res.width / res.height; + var customAspectRadio = width / height; + + self.croperTarget = res.path; + + if (innerAspectRadio < customAspectRadio) { + self.rectX = x; + self.baseWidth = width; + self.baseHeight = width / innerAspectRadio; + self.rectY = y - Math.abs((height - self.baseHeight) / 2); + } else { + self.rectY = y; + self.baseWidth = height * innerAspectRadio; + self.baseHeight = height; + self.rectX = x - Math.abs((width - self.baseWidth) / 2); + } + + self.imgLeft = self.rectX; + self.imgTop = self.rectY; + self.scaleWidth = self.baseWidth; + self.scaleHeight = self.baseHeight; + + self.update(); + + return new Promise(function(resolve) { + self.updateCanvas(resolve); + }) + }) + .then(function() { + tools_7(self.onImageLoad) && self.onImageLoad(self.ctx, self); + }) + }; + + self.removeImage = function() { + self.src = ''; + self.croperTarget = ''; + return draw(self.ctx) + }; + + self.getCropperBase64 = function(done) { + if (done === void 0) done = function() {}; + + CanvasToBase64.convertToBMP({ + canvasId: id, + x: x, + y: y, + width: width, + height: height + }, done); + }; + + self.getCropperImage = function(opt, fn) { + var customOptions = opt; + + var canvasOptions = { + canvasId: id, + x: x, + y: y, + width: width, + height: height + }; + + var task = function() { + return Promise.resolve(); + }; + + if ( + tools_10(customOptions) && + customOptions.original + ) { + // original mode + task = function() { + self.targetCtx.drawImage( + self.croperTarget, + self.imgLeft * pixelRatio, + self.imgTop * pixelRatio, + self.scaleWidth * pixelRatio, + self.scaleHeight * pixelRatio + ); + + canvasOptions = { + canvasId: targetId, + x: x * pixelRatio, + y: y * pixelRatio, + width: width * pixelRatio, + height: height * pixelRatio + }; + + return draw(self.targetCtx) + }; + } + + return task() + .then(function() { + if (tools_10(customOptions)) { + canvasOptions = Object.assign({}, canvasOptions, customOptions); + } + + if (tools_7(customOptions)) { + fn = customOptions; + } + + var arg = canvasOptions.componentContext ? + [canvasOptions, canvasOptions.componentContext] : + [canvasOptions]; + + return canvasToTempFilePath.apply(null, arg) + }) + .then(function(res) { + var tempFilePath = res.tempFilePath; + + return tools_7(fn) ? + fn.call(self, tempFilePath, null) : + tempFilePath + }) + .catch(function(err) { + if (tools_7(fn)) { + fn.call(self, null, err); + } else { + throw err + } + }) + }; + } + + /** + * 获取最新缩放值 + * @param oldScale 上一次触摸结束后的缩放值 + * @param oldDistance 上一次触摸结束后的双指距离 + * @param zoom 缩放系数 + * @param touch0 第一指touch对象 + * @param touch1 第二指touch对象 + * @returns {*} + */ + var getNewScale = function(oldScale, oldDistance, zoom, touch0, touch1) { + var xMove, yMove, newDistance; + // 计算二指最新距离 + xMove = Math.round(touch1.x - touch0.x); + yMove = Math.round(touch1.y - touch0.y); + newDistance = Math.round(Math.sqrt(xMove * xMove + yMove * yMove)); + + return oldScale + 0.001 * zoom * (newDistance - oldDistance) + }; + + function update() { + var self = this; + + if (!self.src) { + return + } + + self.__oneTouchStart = function(touch) { + self.touchX0 = Math.round(touch.x); + self.touchY0 = Math.round(touch.y); + }; + + self.__oneTouchMove = function(touch) { + var xMove, yMove; + // 计算单指移动的距离 + if (self.touchended) { + return self.updateCanvas() + } + xMove = Math.round(touch.x - self.touchX0); + yMove = Math.round(touch.y - self.touchY0); + + var imgLeft = Math.round(self.rectX + xMove); + var imgTop = Math.round(self.rectY + yMove); + + self.outsideBound(imgLeft, imgTop); + + self.updateCanvas(); + }; + + self.__twoTouchStart = function(touch0, touch1) { + var xMove, yMove, oldDistance; + + self.touchX1 = Math.round(self.rectX + self.scaleWidth / 2); + self.touchY1 = Math.round(self.rectY + self.scaleHeight / 2); + + // 计算两指距离 + xMove = Math.round(touch1.x - touch0.x); + yMove = Math.round(touch1.y - touch0.y); + oldDistance = Math.round(Math.sqrt(xMove * xMove + yMove * yMove)); + + self.oldDistance = oldDistance; + }; + + self.__twoTouchMove = function(touch0, touch1) { + var oldScale = self.oldScale; + var oldDistance = self.oldDistance; + var scale = self.scale; + var zoom = self.zoom; + + self.newScale = getNewScale(oldScale, oldDistance, zoom, touch0, touch1); + + // 设定缩放范围 + self.newScale <= 1 && (self.newScale = 1); + self.newScale >= scale && (self.newScale = scale); + + self.scaleWidth = Math.round(self.newScale * self.baseWidth); + self.scaleHeight = Math.round(self.newScale * self.baseHeight); + var imgLeft = Math.round(self.touchX1 - self.scaleWidth / 2); + var imgTop = Math.round(self.touchY1 - self.scaleHeight / 2); + + self.outsideBound(imgLeft, imgTop); + + self.updateCanvas(); + }; + + self.__xtouchEnd = function() { + self.oldScale = self.newScale; + self.rectX = self.imgLeft; + self.rectY = self.imgTop; + }; + } + + var handle = { + // 图片手势初始监测 + touchStart: function touchStart(e) { + var self = this; + var ref = e.touches; + var touch0 = ref[0]; + var touch1 = ref[1]; + + if (!self.src) { + return + } + + setTouchState(self, true, null, null); + + // 计算第一个触摸点的位置,并参照改点进行缩放 + self.__oneTouchStart(touch0); + + // 两指手势触发 + if (e.touches.length >= 2) { + self.__twoTouchStart(touch0, touch1); + } + }, + + // 图片手势动态缩放 + touchMove: function touchMove(e) { + var self = this; + var ref = e.touches; + var touch0 = ref[0]; + var touch1 = ref[1]; + + if (!self.src) { + return + } + + setTouchState(self, null, true); + + // 单指手势时触发 + if (e.touches.length === 1) { + self.__oneTouchMove(touch0); + } + // 两指手势触发 + if (e.touches.length >= 2) { + self.__twoTouchMove(touch0, touch1); + } + }, + + touchEnd: function touchEnd(e) { + var self = this; + + if (!self.src) { + return + } + + setTouchState(self, false, false, true); + self.__xtouchEnd(); + } + }; + + function cut() { + var self = this; + var boundWidth = self.width; // 裁剪框默认宽度,即整个画布宽度 + var boundHeight = self.height; + // 裁剪框默认高度,即整个画布高度 + var ref = self.cut; + var x = ref.x; + if (x === void 0) x = 0; + var y = ref.y; + if (y === void 0) y = 0; + var width = ref.width; + if (width === void 0) width = boundWidth; + var height = ref.height; + if (height === void 0) height = boundHeight; + + /** + * 设置边界 + * @param imgLeft 图片左上角横坐标值 + * @param imgTop 图片左上角纵坐标值 + */ + self.outsideBound = function(imgLeft, imgTop) { + self.imgLeft = imgLeft >= x ? + x : + self.scaleWidth + imgLeft - x <= width ? + x + width - self.scaleWidth : + imgLeft; + + self.imgTop = imgTop >= y ? + y : + self.scaleHeight + imgTop - y <= height ? + y + height - self.scaleHeight : + imgTop; + }; + + /** + * 设置边界样式 + * @param color 边界颜色 + */ + self.setBoundStyle = function(ref) { + if (ref === void 0) ref = {}; + var color = ref.color; + if (color === void 0) color = '#04b00f'; + var mask = ref.mask; + if (mask === void 0) mask = 'rgba(0, 0, 0, 0.3)'; + var lineWidth = ref.lineWidth; + if (lineWidth === void 0) lineWidth = 1; + + var half = lineWidth / 2; + var boundOption = [{ + start: { + x: x - half, + y: y + 10 - half + }, + step1: { + x: x - half, + y: y - half + }, + step2: { + x: x + 10 - half, + y: y - half + } + }, + { + start: { + x: x - half, + y: y + height - 10 + half + }, + step1: { + x: x - half, + y: y + height + half + }, + step2: { + x: x + 10 - half, + y: y + height + half + } + }, + { + start: { + x: x + width - 10 + half, + y: y - half + }, + step1: { + x: x + width + half, + y: y - half + }, + step2: { + x: x + width + half, + y: y + 10 - half + } + }, + { + start: { + x: x + width + half, + y: y + height - 10 + half + }, + step1: { + x: x + width + half, + y: y + height + half + }, + step2: { + x: x + width - 10 + half, + y: y + height + half + } + } + ]; + + // 绘制半透明层 + self.ctx.beginPath(); + self.ctx.setFillStyle(mask); + self.ctx.fillRect(0, 0, x, boundHeight); + self.ctx.fillRect(x, 0, width, y); + self.ctx.fillRect(x, y + height, width, boundHeight - y - height); + self.ctx.fillRect(x + width, 0, boundWidth - x - width, boundHeight); + self.ctx.fill(); + + boundOption.forEach(function(op) { + self.ctx.beginPath(); + self.ctx.setStrokeStyle(color); + self.ctx.setLineWidth(lineWidth); + self.ctx.moveTo(op.start.x, op.start.y); + self.ctx.lineTo(op.step1.x, op.step1.y); + self.ctx.lineTo(op.step2.x, op.step2.y); + self.ctx.stroke(); + }); + }; + } + + var version = "1.3.9"; + + var WeCropper = function WeCropper(params) { + var self = this; + var _default = {}; + + validator(self, DEFAULT); + + Object.keys(DEFAULT).forEach(function(key) { + _default[key] = DEFAULT[key].default; + }); + Object.assign(self, _default, params); + + self.prepare(); + self.attachPage(); + self.createCtx(); + self.observer(); + self.cutt(); + self.methods(); + self.init(); + self.update(); + + return self + }; + + WeCropper.prototype.init = function init() { + var self = this; + var src = self.src; + + self.version = version; + + typeof self.onReady === 'function' && self.onReady(self.ctx, self); + + if (src) { + self.pushOrign(src); + } else { + self.updateCanvas(); + } + setTouchState(self, false, false, false); + + self.oldScale = 1; + self.newScale = 1; + + return self + }; + + Object.assign(WeCropper.prototype, handle); + + WeCropper.prototype.prepare = prepare; + WeCropper.prototype.observer = observer; + WeCropper.prototype.methods = methods; + WeCropper.prototype.cutt = cut; + WeCropper.prototype.update = update; + + return WeCropper; + +}))); diff --git a/uview-ui/components/u-avatar/u-avatar.vue b/uview-ui/components/u-avatar/u-avatar.vue new file mode 100644 index 0000000000000000000000000000000000000000..f92d318d64746e4fee42ce3715e0fd2d07fea824 --- /dev/null +++ b/uview-ui/components/u-avatar/u-avatar.vue @@ -0,0 +1,244 @@ + + + + + diff --git a/uview-ui/components/u-back-top/u-back-top.vue b/uview-ui/components/u-back-top/u-back-top.vue new file mode 100644 index 0000000000000000000000000000000000000000..7970fc7ab5c13878253f39d12b5ee3e6073a9027 --- /dev/null +++ b/uview-ui/components/u-back-top/u-back-top.vue @@ -0,0 +1,153 @@ + + + + + diff --git a/uview-ui/components/u-badge/u-badge.vue b/uview-ui/components/u-badge/u-badge.vue new file mode 100644 index 0000000000000000000000000000000000000000..e85b133ae4623769ddfeb4e739a1e22460d2f632 --- /dev/null +++ b/uview-ui/components/u-badge/u-badge.vue @@ -0,0 +1,216 @@ + + + + + \ No newline at end of file diff --git a/uview-ui/components/u-button/u-button.vue b/uview-ui/components/u-button/u-button.vue new file mode 100644 index 0000000000000000000000000000000000000000..82c3a6f08b37fb5af7c4c7be82109b7775f09277 --- /dev/null +++ b/uview-ui/components/u-button/u-button.vue @@ -0,0 +1,596 @@ + + + + + diff --git a/uview-ui/components/u-calendar/u-calendar.vue b/uview-ui/components/u-calendar/u-calendar.vue new file mode 100644 index 0000000000000000000000000000000000000000..6602bd03fde6582d6c34807373babe2ca5773522 --- /dev/null +++ b/uview-ui/components/u-calendar/u-calendar.vue @@ -0,0 +1,639 @@ + + + + \ No newline at end of file diff --git a/uview-ui/components/u-car-keyboard/u-car-keyboard.vue b/uview-ui/components/u-car-keyboard/u-car-keyboard.vue new file mode 100644 index 0000000000000000000000000000000000000000..84b14678e2e82fd200ef6c15930f415a8d4df1df --- /dev/null +++ b/uview-ui/components/u-car-keyboard/u-car-keyboard.vue @@ -0,0 +1,257 @@ + + + + + diff --git a/uview-ui/components/u-card/u-card.vue b/uview-ui/components/u-card/u-card.vue new file mode 100644 index 0000000000000000000000000000000000000000..add01cba02eafa9ff81b7a02870c9454e37401dc --- /dev/null +++ b/uview-ui/components/u-card/u-card.vue @@ -0,0 +1,298 @@ + + + + + diff --git a/uview-ui/components/u-cell-group/u-cell-group.vue b/uview-ui/components/u-cell-group/u-cell-group.vue new file mode 100644 index 0000000000000000000000000000000000000000..3fbca72588ef3c0fa87b4753c057aa7b28bad6ac --- /dev/null +++ b/uview-ui/components/u-cell-group/u-cell-group.vue @@ -0,0 +1,70 @@ + + + + + diff --git a/uview-ui/components/u-cell-item/u-cell-item.vue b/uview-ui/components/u-cell-item/u-cell-item.vue new file mode 100644 index 0000000000000000000000000000000000000000..c44fc9ad49334b0f0d4a979f201b52f06d28beba --- /dev/null +++ b/uview-ui/components/u-cell-item/u-cell-item.vue @@ -0,0 +1,316 @@ + + + + + diff --git a/uview-ui/components/u-checkbox-group/u-checkbox-group.vue b/uview-ui/components/u-checkbox-group/u-checkbox-group.vue new file mode 100644 index 0000000000000000000000000000000000000000..6a149b33f10a82506ef566e183e039c5501f9720 --- /dev/null +++ b/uview-ui/components/u-checkbox-group/u-checkbox-group.vue @@ -0,0 +1,123 @@ + + + + + diff --git a/uview-ui/components/u-checkbox/u-checkbox.vue b/uview-ui/components/u-checkbox/u-checkbox.vue new file mode 100644 index 0000000000000000000000000000000000000000..94144616b0ca290051eabadb78eea185933d187d --- /dev/null +++ b/uview-ui/components/u-checkbox/u-checkbox.vue @@ -0,0 +1,284 @@ + + + + + diff --git a/uview-ui/components/u-circle-progress/u-circle-progress.vue b/uview-ui/components/u-circle-progress/u-circle-progress.vue new file mode 100644 index 0000000000000000000000000000000000000000..46e7c18105724a9c9cd771575efcdbd5f95bd37f --- /dev/null +++ b/uview-ui/components/u-circle-progress/u-circle-progress.vue @@ -0,0 +1,220 @@ + + + + + diff --git a/uview-ui/components/u-col/u-col.vue b/uview-ui/components/u-col/u-col.vue new file mode 100644 index 0000000000000000000000000000000000000000..3b6cc64ece6b284ae2a0be128bffa51236cce6c0 --- /dev/null +++ b/uview-ui/components/u-col/u-col.vue @@ -0,0 +1,156 @@ + + + + + diff --git a/uview-ui/components/u-collapse-item/u-collapse-item.vue b/uview-ui/components/u-collapse-item/u-collapse-item.vue new file mode 100644 index 0000000000000000000000000000000000000000..3b66bfa5583883cc5f779cab7f7cb9d96f7a5d41 --- /dev/null +++ b/uview-ui/components/u-collapse-item/u-collapse-item.vue @@ -0,0 +1,204 @@ + + + + + diff --git a/uview-ui/components/u-collapse/u-collapse.vue b/uview-ui/components/u-collapse/u-collapse.vue new file mode 100644 index 0000000000000000000000000000000000000000..8572957adf5722656fe1dd9738b9f92635616c6a --- /dev/null +++ b/uview-ui/components/u-collapse/u-collapse.vue @@ -0,0 +1,99 @@ + + + + + diff --git a/uview-ui/components/u-column-notice/u-column-notice.vue b/uview-ui/components/u-column-notice/u-column-notice.vue new file mode 100644 index 0000000000000000000000000000000000000000..dd8bd3182d5dc207dd116b6c306c9ee59b3622d3 --- /dev/null +++ b/uview-ui/components/u-column-notice/u-column-notice.vue @@ -0,0 +1,237 @@ + + + + + diff --git a/uview-ui/components/u-count-down/u-count-down.vue b/uview-ui/components/u-count-down/u-count-down.vue new file mode 100644 index 0000000000000000000000000000000000000000..7285d672179ea8d3088dfdb6bd567851baf1c7c6 --- /dev/null +++ b/uview-ui/components/u-count-down/u-count-down.vue @@ -0,0 +1,318 @@ + + + + + diff --git a/uview-ui/components/u-count-to/u-count-to.vue b/uview-ui/components/u-count-to/u-count-to.vue new file mode 100644 index 0000000000000000000000000000000000000000..053dc5ffefcf1ad538f0c7a0832180f4b99dbd0d --- /dev/null +++ b/uview-ui/components/u-count-to/u-count-to.vue @@ -0,0 +1,241 @@ + + + + + diff --git a/uview-ui/components/u-divider/u-divider.vue b/uview-ui/components/u-divider/u-divider.vue new file mode 100644 index 0000000000000000000000000000000000000000..6f8d7e69ee819ddeebe436dfe2594fb6d80afcfd --- /dev/null +++ b/uview-ui/components/u-divider/u-divider.vue @@ -0,0 +1,153 @@ + + + + + diff --git a/uview-ui/components/u-dropdown-item/u-dropdown-item.vue b/uview-ui/components/u-dropdown-item/u-dropdown-item.vue new file mode 100644 index 0000000000000000000000000000000000000000..ba60d8f769a5e31e63c625a294cbd5d3e040e8ff --- /dev/null +++ b/uview-ui/components/u-dropdown-item/u-dropdown-item.vue @@ -0,0 +1,132 @@ + + + + + diff --git a/uview-ui/components/u-dropdown/u-dropdown.vue b/uview-ui/components/u-dropdown/u-dropdown.vue new file mode 100644 index 0000000000000000000000000000000000000000..a62e469aee7574d8b9666b37b869a0acdd8bedd7 --- /dev/null +++ b/uview-ui/components/u-dropdown/u-dropdown.vue @@ -0,0 +1,298 @@ + + + + + diff --git a/uview-ui/components/u-empty/u-empty.vue b/uview-ui/components/u-empty/u-empty.vue new file mode 100644 index 0000000000000000000000000000000000000000..2c77b24eef006f9fad3c1f3098900b610ef34105 --- /dev/null +++ b/uview-ui/components/u-empty/u-empty.vue @@ -0,0 +1,193 @@ + + + + + diff --git a/uview-ui/components/u-field/u-field.vue b/uview-ui/components/u-field/u-field.vue new file mode 100644 index 0000000000000000000000000000000000000000..b562798acea97a6231a9f7148bd3ee17f64c516e --- /dev/null +++ b/uview-ui/components/u-field/u-field.vue @@ -0,0 +1,384 @@ +