Commit d438e211 by 梁建民

js

parent 2eeb1b51
......@@ -39,7 +39,7 @@ const actions = {
});
},
downloadFile({commit}, payload) {
downloadFile: function ({commit}, payload) {
var param = {
data_id: payload.id
......@@ -53,6 +53,14 @@ const actions = {
if (data.err_code == 0) {
window.location.href = data.data[0].file_url;
} else if (data.err_code == 1) {
Toast({
message: data.err_msg,
duration: 2000
});
setTimeout(function () {
window.location.href = '/v3/login?referer=%2fh5%2fview%2f%23%2fdownoad&from=download'
}, 2000);
} else {
Toast({
message: data.err_msg,
......
......@@ -3857,7 +3857,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var vue_
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ \"./node_modules/_vue@2.6.10@vue/dist/vue.runtime.esm.js\");\n/* harmony import */ var vant__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! vant */ \"./node_modules/_vant@2.0.1@vant/es/index.js\");\n/* harmony import */ var _api_index__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../api/index */ \"./src/api/index.js\");\n/* harmony import */ var _util_index__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../util/index */ \"./src/util/index.js\");\n\n\n\n\nvue__WEBPACK_IMPORTED_MODULE_0__[\"default\"].use(vant__WEBPACK_IMPORTED_MODULE_1__[\"Toast\"]);\nvar state = {\n loading: false,\n getfileuploadbanner: [],\n articleShowData: []\n};\nvar mutations = {\n getfileuploadbanner: function getfileuploadbanner(state, payload) {\n state.getfileuploadbanner = payload.data;\n },\n articleShowData: function articleShowData(state, payload) {\n state.articleShowData = payload.data;\n }\n};\nvar actions = {\n getfileuploadbanner: function getfileuploadbanner(_ref, payload) {\n var commit = _ref.commit;\n var params = _util_index__WEBPACK_IMPORTED_MODULE_3__[\"default\"].getParams();\n _api_index__WEBPACK_IMPORTED_MODULE_2__[\"services\"].getfileuploadbanner(params).then(function (res) {\n var data = res.data;\n\n if (data.err_code == 0) {\n commit({\n type: 'getfileuploadbanner',\n data: data.data.data\n });\n }\n }).catch(function (err) {});\n },\n downloadFile: function downloadFile(_ref2, payload) {\n var commit = _ref2.commit;\n var param = {\n data_id: payload.id\n };\n var params = _util_index__WEBPACK_IMPORTED_MODULE_3__[\"default\"].getParams(param);\n _api_index__WEBPACK_IMPORTED_MODULE_2__[\"services\"].downloadFile(params).then(function (res) {\n var data = res.data;\n\n if (data.err_code == 0) {\n window.location.href = data.data[0].file_url;\n } else {\n Object(vant__WEBPACK_IMPORTED_MODULE_1__[\"Toast\"])({\n message: data.err_msg,\n duration: 2000\n });\n }\n }).catch(function (err) {});\n },\n articleShowData: function articleShowData(_ref3, payload) {\n var commit = _ref3.commit;\n var params = _util_index__WEBPACK_IMPORTED_MODULE_3__[\"default\"].getParams();\n _api_index__WEBPACK_IMPORTED_MODULE_2__[\"services\"].articleShowData(params).then(function (res) {\n var data = res.data;\n\n if (data.err_code == 0) {\n commit({\n type: 'articleShowData',\n data: data.data\n });\n } else {\n Object(vant__WEBPACK_IMPORTED_MODULE_1__[\"Toast\"])({\n message: data.err_msg,\n duration: 2000\n });\n }\n }).catch(function (err) {});\n }\n};\nvar getters = {};\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n state: state,\n mutations: mutations,\n actions: actions,\n getters: getters\n});\n\n//# sourceURL=webpack:///./src/store/modules/download/index.js?");
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ \"./node_modules/_vue@2.6.10@vue/dist/vue.runtime.esm.js\");\n/* harmony import */ var vant__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! vant */ \"./node_modules/_vant@2.0.1@vant/es/index.js\");\n/* harmony import */ var _api_index__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../api/index */ \"./src/api/index.js\");\n/* harmony import */ var _util_index__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../util/index */ \"./src/util/index.js\");\n\n\n\n\nvue__WEBPACK_IMPORTED_MODULE_0__[\"default\"].use(vant__WEBPACK_IMPORTED_MODULE_1__[\"Toast\"]);\nvar state = {\n loading: false,\n getfileuploadbanner: [],\n articleShowData: []\n};\nvar mutations = {\n getfileuploadbanner: function getfileuploadbanner(state, payload) {\n state.getfileuploadbanner = payload.data;\n },\n articleShowData: function articleShowData(state, payload) {\n state.articleShowData = payload.data;\n }\n};\nvar actions = {\n getfileuploadbanner: function getfileuploadbanner(_ref, payload) {\n var commit = _ref.commit;\n var params = _util_index__WEBPACK_IMPORTED_MODULE_3__[\"default\"].getParams();\n _api_index__WEBPACK_IMPORTED_MODULE_2__[\"services\"].getfileuploadbanner(params).then(function (res) {\n var data = res.data;\n\n if (data.err_code == 0) {\n commit({\n type: 'getfileuploadbanner',\n data: data.data.data\n });\n }\n }).catch(function (err) {});\n },\n downloadFile: function downloadFile(_ref2, payload) {\n var commit = _ref2.commit;\n var param = {\n data_id: payload.id\n };\n var params = _util_index__WEBPACK_IMPORTED_MODULE_3__[\"default\"].getParams(param);\n _api_index__WEBPACK_IMPORTED_MODULE_2__[\"services\"].downloadFile(params).then(function (res) {\n var data = res.data;\n\n if (data.err_code == 0) {\n window.location.href = data.data[0].file_url;\n } else if (data.err_code == 1) {\n Object(vant__WEBPACK_IMPORTED_MODULE_1__[\"Toast\"])({\n message: data.err_msg,\n duration: 2000\n });\n setTimeout(function () {\n window.location.href = '/v3/login?referer=%2fh5%2fview%2f%23%2fdownoad&from=download';\n }, 2000);\n } else {\n Object(vant__WEBPACK_IMPORTED_MODULE_1__[\"Toast\"])({\n message: data.err_msg,\n duration: 2000\n });\n }\n }).catch(function (err) {});\n },\n articleShowData: function articleShowData(_ref3, payload) {\n var commit = _ref3.commit;\n var params = _util_index__WEBPACK_IMPORTED_MODULE_3__[\"default\"].getParams();\n _api_index__WEBPACK_IMPORTED_MODULE_2__[\"services\"].articleShowData(params).then(function (res) {\n var data = res.data;\n\n if (data.err_code == 0) {\n commit({\n type: 'articleShowData',\n data: data.data\n });\n } else {\n Object(vant__WEBPACK_IMPORTED_MODULE_1__[\"Toast\"])({\n message: data.err_msg,\n duration: 2000\n });\n }\n }).catch(function (err) {});\n }\n};\nvar getters = {};\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n state: state,\n mutations: mutations,\n actions: actions,\n getters: getters\n});\n\n//# sourceURL=webpack:///./src/store/modules/download/index.js?");
/***/ }),
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment