3187 lines
100 KiB
JavaScript
3187 lines
100 KiB
JavaScript
|
|
if (typeof Promise !== "undefined" && !Promise.prototype.finally) {
|
|||
|
|
Promise.prototype.finally = function(callback) {
|
|||
|
|
const promise = this.constructor;
|
|||
|
|
return this.then(
|
|||
|
|
(value) => promise.resolve(callback()).then(() => value),
|
|||
|
|
(reason) => promise.resolve(callback()).then(() => {
|
|||
|
|
throw reason;
|
|||
|
|
})
|
|||
|
|
);
|
|||
|
|
};
|
|||
|
|
}
|
|||
|
|
;
|
|||
|
|
if (typeof uni !== "undefined" && uni && uni.requireGlobal) {
|
|||
|
|
const global2 = uni.requireGlobal();
|
|||
|
|
ArrayBuffer = global2.ArrayBuffer;
|
|||
|
|
Int8Array = global2.Int8Array;
|
|||
|
|
Uint8Array = global2.Uint8Array;
|
|||
|
|
Uint8ClampedArray = global2.Uint8ClampedArray;
|
|||
|
|
Int16Array = global2.Int16Array;
|
|||
|
|
Uint16Array = global2.Uint16Array;
|
|||
|
|
Int32Array = global2.Int32Array;
|
|||
|
|
Uint32Array = global2.Uint32Array;
|
|||
|
|
Float32Array = global2.Float32Array;
|
|||
|
|
Float64Array = global2.Float64Array;
|
|||
|
|
BigInt64Array = global2.BigInt64Array;
|
|||
|
|
BigUint64Array = global2.BigUint64Array;
|
|||
|
|
}
|
|||
|
|
;
|
|||
|
|
if (uni.restoreGlobal) {
|
|||
|
|
uni.restoreGlobal(Vue, weex, plus, setTimeout, clearTimeout, setInterval, clearInterval);
|
|||
|
|
}
|
|||
|
|
(function(vue) {
|
|||
|
|
"use strict";
|
|||
|
|
function formatAppLog(type, filename, ...args) {
|
|||
|
|
if (uni.__log__) {
|
|||
|
|
uni.__log__(type, filename, ...args);
|
|||
|
|
} else {
|
|||
|
|
console[type].apply(console, [...args, filename]);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
function resolveEasycom(component, easycom) {
|
|||
|
|
return typeof component === "string" ? easycom : component;
|
|||
|
|
}
|
|||
|
|
function getDevtoolsGlobalHook() {
|
|||
|
|
return getTarget().__VUE_DEVTOOLS_GLOBAL_HOOK__;
|
|||
|
|
}
|
|||
|
|
function getTarget() {
|
|||
|
|
return typeof navigator !== "undefined" && typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {};
|
|||
|
|
}
|
|||
|
|
const isProxyAvailable = typeof Proxy === "function";
|
|||
|
|
const HOOK_SETUP = "devtools-plugin:setup";
|
|||
|
|
const HOOK_PLUGIN_SETTINGS_SET = "plugin:settings:set";
|
|||
|
|
class ApiProxy {
|
|||
|
|
constructor(plugin, hook) {
|
|||
|
|
this.target = null;
|
|||
|
|
this.targetQueue = [];
|
|||
|
|
this.onQueue = [];
|
|||
|
|
this.plugin = plugin;
|
|||
|
|
this.hook = hook;
|
|||
|
|
const defaultSettings = {};
|
|||
|
|
if (plugin.settings) {
|
|||
|
|
for (const id in plugin.settings) {
|
|||
|
|
const item = plugin.settings[id];
|
|||
|
|
defaultSettings[id] = item.defaultValue;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
const localSettingsSaveId = `__vue-devtools-plugin-settings__${plugin.id}`;
|
|||
|
|
let currentSettings = { ...defaultSettings };
|
|||
|
|
try {
|
|||
|
|
const raw = localStorage.getItem(localSettingsSaveId);
|
|||
|
|
const data = JSON.parse(raw);
|
|||
|
|
Object.assign(currentSettings, data);
|
|||
|
|
} catch (e) {
|
|||
|
|
}
|
|||
|
|
this.fallbacks = {
|
|||
|
|
getSettings() {
|
|||
|
|
return currentSettings;
|
|||
|
|
},
|
|||
|
|
setSettings(value) {
|
|||
|
|
try {
|
|||
|
|
localStorage.setItem(localSettingsSaveId, JSON.stringify(value));
|
|||
|
|
} catch (e) {
|
|||
|
|
}
|
|||
|
|
currentSettings = value;
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
hook.on(HOOK_PLUGIN_SETTINGS_SET, (pluginId, value) => {
|
|||
|
|
if (pluginId === this.plugin.id) {
|
|||
|
|
this.fallbacks.setSettings(value);
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
this.proxiedOn = new Proxy({}, {
|
|||
|
|
get: (_target, prop) => {
|
|||
|
|
if (this.target) {
|
|||
|
|
return this.target.on[prop];
|
|||
|
|
} else {
|
|||
|
|
return (...args) => {
|
|||
|
|
this.onQueue.push({
|
|||
|
|
method: prop,
|
|||
|
|
args
|
|||
|
|
});
|
|||
|
|
};
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
this.proxiedTarget = new Proxy({}, {
|
|||
|
|
get: (_target, prop) => {
|
|||
|
|
if (this.target) {
|
|||
|
|
return this.target[prop];
|
|||
|
|
} else if (prop === "on") {
|
|||
|
|
return this.proxiedOn;
|
|||
|
|
} else if (Object.keys(this.fallbacks).includes(prop)) {
|
|||
|
|
return (...args) => {
|
|||
|
|
this.targetQueue.push({
|
|||
|
|
method: prop,
|
|||
|
|
args,
|
|||
|
|
resolve: () => {
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
return this.fallbacks[prop](...args);
|
|||
|
|
};
|
|||
|
|
} else {
|
|||
|
|
return (...args) => {
|
|||
|
|
return new Promise((resolve) => {
|
|||
|
|
this.targetQueue.push({
|
|||
|
|
method: prop,
|
|||
|
|
args,
|
|||
|
|
resolve
|
|||
|
|
});
|
|||
|
|
});
|
|||
|
|
};
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
async setRealTarget(target) {
|
|||
|
|
this.target = target;
|
|||
|
|
for (const item of this.onQueue) {
|
|||
|
|
this.target.on[item.method](...item.args);
|
|||
|
|
}
|
|||
|
|
for (const item of this.targetQueue) {
|
|||
|
|
item.resolve(await this.target[item.method](...item.args));
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
function setupDevtoolsPlugin(pluginDescriptor, setupFn) {
|
|||
|
|
const target = getTarget();
|
|||
|
|
const hook = getDevtoolsGlobalHook();
|
|||
|
|
const enableProxy = isProxyAvailable && pluginDescriptor.enableEarlyProxy;
|
|||
|
|
if (hook && (target.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !enableProxy)) {
|
|||
|
|
hook.emit(HOOK_SETUP, pluginDescriptor, setupFn);
|
|||
|
|
} else {
|
|||
|
|
const proxy = enableProxy ? new ApiProxy(pluginDescriptor, hook) : null;
|
|||
|
|
const list = target.__VUE_DEVTOOLS_PLUGINS__ = target.__VUE_DEVTOOLS_PLUGINS__ || [];
|
|||
|
|
list.push({
|
|||
|
|
pluginDescriptor,
|
|||
|
|
setupFn,
|
|||
|
|
proxy
|
|||
|
|
});
|
|||
|
|
if (proxy)
|
|||
|
|
setupFn(proxy.proxiedTarget);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
/*!
|
|||
|
|
* vuex v4.1.0
|
|||
|
|
* (c) 2022 Evan You
|
|||
|
|
* @license MIT
|
|||
|
|
*/
|
|||
|
|
var storeKey = "store";
|
|||
|
|
function forEachValue(obj, fn) {
|
|||
|
|
Object.keys(obj).forEach(function(key) {
|
|||
|
|
return fn(obj[key], key);
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
function isObject(obj) {
|
|||
|
|
return obj !== null && typeof obj === "object";
|
|||
|
|
}
|
|||
|
|
function isPromise(val) {
|
|||
|
|
return val && typeof val.then === "function";
|
|||
|
|
}
|
|||
|
|
function assert(condition, msg) {
|
|||
|
|
if (!condition) {
|
|||
|
|
throw new Error("[vuex] " + msg);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
function partial(fn, arg) {
|
|||
|
|
return function() {
|
|||
|
|
return fn(arg);
|
|||
|
|
};
|
|||
|
|
}
|
|||
|
|
function genericSubscribe(fn, subs, options) {
|
|||
|
|
if (subs.indexOf(fn) < 0) {
|
|||
|
|
options && options.prepend ? subs.unshift(fn) : subs.push(fn);
|
|||
|
|
}
|
|||
|
|
return function() {
|
|||
|
|
var i = subs.indexOf(fn);
|
|||
|
|
if (i > -1) {
|
|||
|
|
subs.splice(i, 1);
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
}
|
|||
|
|
function resetStore(store2, hot) {
|
|||
|
|
store2._actions = /* @__PURE__ */ Object.create(null);
|
|||
|
|
store2._mutations = /* @__PURE__ */ Object.create(null);
|
|||
|
|
store2._wrappedGetters = /* @__PURE__ */ Object.create(null);
|
|||
|
|
store2._modulesNamespaceMap = /* @__PURE__ */ Object.create(null);
|
|||
|
|
var state = store2.state;
|
|||
|
|
installModule(store2, state, [], store2._modules.root, true);
|
|||
|
|
resetStoreState(store2, state, hot);
|
|||
|
|
}
|
|||
|
|
function resetStoreState(store2, state, hot) {
|
|||
|
|
var oldState = store2._state;
|
|||
|
|
var oldScope = store2._scope;
|
|||
|
|
store2.getters = {};
|
|||
|
|
store2._makeLocalGettersCache = /* @__PURE__ */ Object.create(null);
|
|||
|
|
var wrappedGetters = store2._wrappedGetters;
|
|||
|
|
var computedObj = {};
|
|||
|
|
var computedCache = {};
|
|||
|
|
var scope = vue.effectScope(true);
|
|||
|
|
scope.run(function() {
|
|||
|
|
forEachValue(wrappedGetters, function(fn, key) {
|
|||
|
|
computedObj[key] = partial(fn, store2);
|
|||
|
|
computedCache[key] = vue.computed(function() {
|
|||
|
|
return computedObj[key]();
|
|||
|
|
});
|
|||
|
|
Object.defineProperty(store2.getters, key, {
|
|||
|
|
get: function() {
|
|||
|
|
return computedCache[key].value;
|
|||
|
|
},
|
|||
|
|
enumerable: true
|
|||
|
|
// for local getters
|
|||
|
|
});
|
|||
|
|
});
|
|||
|
|
});
|
|||
|
|
store2._state = vue.reactive({
|
|||
|
|
data: state
|
|||
|
|
});
|
|||
|
|
store2._scope = scope;
|
|||
|
|
if (store2.strict) {
|
|||
|
|
enableStrictMode(store2);
|
|||
|
|
}
|
|||
|
|
if (oldState) {
|
|||
|
|
if (hot) {
|
|||
|
|
store2._withCommit(function() {
|
|||
|
|
oldState.data = null;
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
if (oldScope) {
|
|||
|
|
oldScope.stop();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
function installModule(store2, rootState, path, module, hot) {
|
|||
|
|
var isRoot = !path.length;
|
|||
|
|
var namespace = store2._modules.getNamespace(path);
|
|||
|
|
if (module.namespaced) {
|
|||
|
|
if (store2._modulesNamespaceMap[namespace] && true) {
|
|||
|
|
console.error("[vuex] duplicate namespace " + namespace + " for the namespaced module " + path.join("/"));
|
|||
|
|
}
|
|||
|
|
store2._modulesNamespaceMap[namespace] = module;
|
|||
|
|
}
|
|||
|
|
if (!isRoot && !hot) {
|
|||
|
|
var parentState = getNestedState(rootState, path.slice(0, -1));
|
|||
|
|
var moduleName = path[path.length - 1];
|
|||
|
|
store2._withCommit(function() {
|
|||
|
|
{
|
|||
|
|
if (moduleName in parentState) {
|
|||
|
|
console.warn(
|
|||
|
|
'[vuex] state field "' + moduleName + '" was overridden by a module with the same name at "' + path.join(".") + '"'
|
|||
|
|
);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
parentState[moduleName] = module.state;
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
var local = module.context = makeLocalContext(store2, namespace, path);
|
|||
|
|
module.forEachMutation(function(mutation, key) {
|
|||
|
|
var namespacedType = namespace + key;
|
|||
|
|
registerMutation(store2, namespacedType, mutation, local);
|
|||
|
|
});
|
|||
|
|
module.forEachAction(function(action, key) {
|
|||
|
|
var type = action.root ? key : namespace + key;
|
|||
|
|
var handler = action.handler || action;
|
|||
|
|
registerAction(store2, type, handler, local);
|
|||
|
|
});
|
|||
|
|
module.forEachGetter(function(getter, key) {
|
|||
|
|
var namespacedType = namespace + key;
|
|||
|
|
registerGetter(store2, namespacedType, getter, local);
|
|||
|
|
});
|
|||
|
|
module.forEachChild(function(child, key) {
|
|||
|
|
installModule(store2, rootState, path.concat(key), child, hot);
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
function makeLocalContext(store2, namespace, path) {
|
|||
|
|
var noNamespace = namespace === "";
|
|||
|
|
var local = {
|
|||
|
|
dispatch: noNamespace ? store2.dispatch : function(_type, _payload, _options) {
|
|||
|
|
var args = unifyObjectStyle(_type, _payload, _options);
|
|||
|
|
var payload = args.payload;
|
|||
|
|
var options = args.options;
|
|||
|
|
var type = args.type;
|
|||
|
|
if (!options || !options.root) {
|
|||
|
|
type = namespace + type;
|
|||
|
|
if (!store2._actions[type]) {
|
|||
|
|
console.error("[vuex] unknown local action type: " + args.type + ", global type: " + type);
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
return store2.dispatch(type, payload);
|
|||
|
|
},
|
|||
|
|
commit: noNamespace ? store2.commit : function(_type, _payload, _options) {
|
|||
|
|
var args = unifyObjectStyle(_type, _payload, _options);
|
|||
|
|
var payload = args.payload;
|
|||
|
|
var options = args.options;
|
|||
|
|
var type = args.type;
|
|||
|
|
if (!options || !options.root) {
|
|||
|
|
type = namespace + type;
|
|||
|
|
if (!store2._mutations[type]) {
|
|||
|
|
console.error("[vuex] unknown local mutation type: " + args.type + ", global type: " + type);
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
store2.commit(type, payload, options);
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
Object.defineProperties(local, {
|
|||
|
|
getters: {
|
|||
|
|
get: noNamespace ? function() {
|
|||
|
|
return store2.getters;
|
|||
|
|
} : function() {
|
|||
|
|
return makeLocalGetters(store2, namespace);
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
state: {
|
|||
|
|
get: function() {
|
|||
|
|
return getNestedState(store2.state, path);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
return local;
|
|||
|
|
}
|
|||
|
|
function makeLocalGetters(store2, namespace) {
|
|||
|
|
if (!store2._makeLocalGettersCache[namespace]) {
|
|||
|
|
var gettersProxy = {};
|
|||
|
|
var splitPos = namespace.length;
|
|||
|
|
Object.keys(store2.getters).forEach(function(type) {
|
|||
|
|
if (type.slice(0, splitPos) !== namespace) {
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
var localType = type.slice(splitPos);
|
|||
|
|
Object.defineProperty(gettersProxy, localType, {
|
|||
|
|
get: function() {
|
|||
|
|
return store2.getters[type];
|
|||
|
|
},
|
|||
|
|
enumerable: true
|
|||
|
|
});
|
|||
|
|
});
|
|||
|
|
store2._makeLocalGettersCache[namespace] = gettersProxy;
|
|||
|
|
}
|
|||
|
|
return store2._makeLocalGettersCache[namespace];
|
|||
|
|
}
|
|||
|
|
function registerMutation(store2, type, handler, local) {
|
|||
|
|
var entry = store2._mutations[type] || (store2._mutations[type] = []);
|
|||
|
|
entry.push(function wrappedMutationHandler(payload) {
|
|||
|
|
handler.call(store2, local.state, payload);
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
function registerAction(store2, type, handler, local) {
|
|||
|
|
var entry = store2._actions[type] || (store2._actions[type] = []);
|
|||
|
|
entry.push(function wrappedActionHandler(payload) {
|
|||
|
|
var res = handler.call(store2, {
|
|||
|
|
dispatch: local.dispatch,
|
|||
|
|
commit: local.commit,
|
|||
|
|
getters: local.getters,
|
|||
|
|
state: local.state,
|
|||
|
|
rootGetters: store2.getters,
|
|||
|
|
rootState: store2.state
|
|||
|
|
}, payload);
|
|||
|
|
if (!isPromise(res)) {
|
|||
|
|
res = Promise.resolve(res);
|
|||
|
|
}
|
|||
|
|
if (store2._devtoolHook) {
|
|||
|
|
return res.catch(function(err) {
|
|||
|
|
store2._devtoolHook.emit("vuex:error", err);
|
|||
|
|
throw err;
|
|||
|
|
});
|
|||
|
|
} else {
|
|||
|
|
return res;
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
function registerGetter(store2, type, rawGetter, local) {
|
|||
|
|
if (store2._wrappedGetters[type]) {
|
|||
|
|
{
|
|||
|
|
console.error("[vuex] duplicate getter key: " + type);
|
|||
|
|
}
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
store2._wrappedGetters[type] = function wrappedGetter(store22) {
|
|||
|
|
return rawGetter(
|
|||
|
|
local.state,
|
|||
|
|
// local state
|
|||
|
|
local.getters,
|
|||
|
|
// local getters
|
|||
|
|
store22.state,
|
|||
|
|
// root state
|
|||
|
|
store22.getters
|
|||
|
|
// root getters
|
|||
|
|
);
|
|||
|
|
};
|
|||
|
|
}
|
|||
|
|
function enableStrictMode(store2) {
|
|||
|
|
vue.watch(function() {
|
|||
|
|
return store2._state.data;
|
|||
|
|
}, function() {
|
|||
|
|
{
|
|||
|
|
assert(store2._committing, "do not mutate vuex store state outside mutation handlers.");
|
|||
|
|
}
|
|||
|
|
}, { deep: true, flush: "sync" });
|
|||
|
|
}
|
|||
|
|
function getNestedState(state, path) {
|
|||
|
|
return path.reduce(function(state2, key) {
|
|||
|
|
return state2[key];
|
|||
|
|
}, state);
|
|||
|
|
}
|
|||
|
|
function unifyObjectStyle(type, payload, options) {
|
|||
|
|
if (isObject(type) && type.type) {
|
|||
|
|
options = payload;
|
|||
|
|
payload = type;
|
|||
|
|
type = type.type;
|
|||
|
|
}
|
|||
|
|
{
|
|||
|
|
assert(typeof type === "string", "expects string as the type, but found " + typeof type + ".");
|
|||
|
|
}
|
|||
|
|
return { type, payload, options };
|
|||
|
|
}
|
|||
|
|
var LABEL_VUEX_BINDINGS = "vuex bindings";
|
|||
|
|
var MUTATIONS_LAYER_ID = "vuex:mutations";
|
|||
|
|
var ACTIONS_LAYER_ID = "vuex:actions";
|
|||
|
|
var INSPECTOR_ID = "vuex";
|
|||
|
|
var actionId = 0;
|
|||
|
|
function addDevtools(app, store2) {
|
|||
|
|
setupDevtoolsPlugin(
|
|||
|
|
{
|
|||
|
|
id: "org.vuejs.vuex",
|
|||
|
|
app,
|
|||
|
|
label: "Vuex",
|
|||
|
|
homepage: "https://next.vuex.vuejs.org/",
|
|||
|
|
logo: "https://vuejs.org/images/icons/favicon-96x96.png",
|
|||
|
|
packageName: "vuex",
|
|||
|
|
componentStateTypes: [LABEL_VUEX_BINDINGS]
|
|||
|
|
},
|
|||
|
|
function(api) {
|
|||
|
|
api.addTimelineLayer({
|
|||
|
|
id: MUTATIONS_LAYER_ID,
|
|||
|
|
label: "Vuex Mutations",
|
|||
|
|
color: COLOR_LIME_500
|
|||
|
|
});
|
|||
|
|
api.addTimelineLayer({
|
|||
|
|
id: ACTIONS_LAYER_ID,
|
|||
|
|
label: "Vuex Actions",
|
|||
|
|
color: COLOR_LIME_500
|
|||
|
|
});
|
|||
|
|
api.addInspector({
|
|||
|
|
id: INSPECTOR_ID,
|
|||
|
|
label: "Vuex",
|
|||
|
|
icon: "storage",
|
|||
|
|
treeFilterPlaceholder: "Filter stores..."
|
|||
|
|
});
|
|||
|
|
api.on.getInspectorTree(function(payload) {
|
|||
|
|
if (payload.app === app && payload.inspectorId === INSPECTOR_ID) {
|
|||
|
|
if (payload.filter) {
|
|||
|
|
var nodes = [];
|
|||
|
|
flattenStoreForInspectorTree(nodes, store2._modules.root, payload.filter, "");
|
|||
|
|
payload.rootNodes = nodes;
|
|||
|
|
} else {
|
|||
|
|
payload.rootNodes = [
|
|||
|
|
formatStoreForInspectorTree(store2._modules.root, "")
|
|||
|
|
];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
api.on.getInspectorState(function(payload) {
|
|||
|
|
if (payload.app === app && payload.inspectorId === INSPECTOR_ID) {
|
|||
|
|
var modulePath = payload.nodeId;
|
|||
|
|
makeLocalGetters(store2, modulePath);
|
|||
|
|
payload.state = formatStoreForInspectorState(
|
|||
|
|
getStoreModule(store2._modules, modulePath),
|
|||
|
|
modulePath === "root" ? store2.getters : store2._makeLocalGettersCache,
|
|||
|
|
modulePath
|
|||
|
|
);
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
api.on.editInspectorState(function(payload) {
|
|||
|
|
if (payload.app === app && payload.inspectorId === INSPECTOR_ID) {
|
|||
|
|
var modulePath = payload.nodeId;
|
|||
|
|
var path = payload.path;
|
|||
|
|
if (modulePath !== "root") {
|
|||
|
|
path = modulePath.split("/").filter(Boolean).concat(path);
|
|||
|
|
}
|
|||
|
|
store2._withCommit(function() {
|
|||
|
|
payload.set(store2._state.data, path, payload.state.value);
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
store2.subscribe(function(mutation, state) {
|
|||
|
|
var data = {};
|
|||
|
|
if (mutation.payload) {
|
|||
|
|
data.payload = mutation.payload;
|
|||
|
|
}
|
|||
|
|
data.state = state;
|
|||
|
|
api.notifyComponentUpdate();
|
|||
|
|
api.sendInspectorTree(INSPECTOR_ID);
|
|||
|
|
api.sendInspectorState(INSPECTOR_ID);
|
|||
|
|
api.addTimelineEvent({
|
|||
|
|
layerId: MUTATIONS_LAYER_ID,
|
|||
|
|
event: {
|
|||
|
|
time: Date.now(),
|
|||
|
|
title: mutation.type,
|
|||
|
|
data
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
});
|
|||
|
|
store2.subscribeAction({
|
|||
|
|
before: function(action, state) {
|
|||
|
|
var data = {};
|
|||
|
|
if (action.payload) {
|
|||
|
|
data.payload = action.payload;
|
|||
|
|
}
|
|||
|
|
action._id = actionId++;
|
|||
|
|
action._time = Date.now();
|
|||
|
|
data.state = state;
|
|||
|
|
api.addTimelineEvent({
|
|||
|
|
layerId: ACTIONS_LAYER_ID,
|
|||
|
|
event: {
|
|||
|
|
time: action._time,
|
|||
|
|
title: action.type,
|
|||
|
|
groupId: action._id,
|
|||
|
|
subtitle: "start",
|
|||
|
|
data
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
},
|
|||
|
|
after: function(action, state) {
|
|||
|
|
var data = {};
|
|||
|
|
var duration = Date.now() - action._time;
|
|||
|
|
data.duration = {
|
|||
|
|
_custom: {
|
|||
|
|
type: "duration",
|
|||
|
|
display: duration + "ms",
|
|||
|
|
tooltip: "Action duration",
|
|||
|
|
value: duration
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
if (action.payload) {
|
|||
|
|
data.payload = action.payload;
|
|||
|
|
}
|
|||
|
|
data.state = state;
|
|||
|
|
api.addTimelineEvent({
|
|||
|
|
layerId: ACTIONS_LAYER_ID,
|
|||
|
|
event: {
|
|||
|
|
time: Date.now(),
|
|||
|
|
title: action.type,
|
|||
|
|
groupId: action._id,
|
|||
|
|
subtitle: "end",
|
|||
|
|
data
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
);
|
|||
|
|
}
|
|||
|
|
var COLOR_LIME_500 = 8702998;
|
|||
|
|
var COLOR_DARK = 6710886;
|
|||
|
|
var COLOR_WHITE = 16777215;
|
|||
|
|
var TAG_NAMESPACED = {
|
|||
|
|
label: "namespaced",
|
|||
|
|
textColor: COLOR_WHITE,
|
|||
|
|
backgroundColor: COLOR_DARK
|
|||
|
|
};
|
|||
|
|
function extractNameFromPath(path) {
|
|||
|
|
return path && path !== "root" ? path.split("/").slice(-2, -1)[0] : "Root";
|
|||
|
|
}
|
|||
|
|
function formatStoreForInspectorTree(module, path) {
|
|||
|
|
return {
|
|||
|
|
id: path || "root",
|
|||
|
|
// all modules end with a `/`, we want the last segment only
|
|||
|
|
// cart/ -> cart
|
|||
|
|
// nested/cart/ -> cart
|
|||
|
|
label: extractNameFromPath(path),
|
|||
|
|
tags: module.namespaced ? [TAG_NAMESPACED] : [],
|
|||
|
|
children: Object.keys(module._children).map(
|
|||
|
|
function(moduleName) {
|
|||
|
|
return formatStoreForInspectorTree(
|
|||
|
|
module._children[moduleName],
|
|||
|
|
path + moduleName + "/"
|
|||
|
|
);
|
|||
|
|
}
|
|||
|
|
)
|
|||
|
|
};
|
|||
|
|
}
|
|||
|
|
function flattenStoreForInspectorTree(result, module, filter, path) {
|
|||
|
|
if (path.includes(filter)) {
|
|||
|
|
result.push({
|
|||
|
|
id: path || "root",
|
|||
|
|
label: path.endsWith("/") ? path.slice(0, path.length - 1) : path || "Root",
|
|||
|
|
tags: module.namespaced ? [TAG_NAMESPACED] : []
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
Object.keys(module._children).forEach(function(moduleName) {
|
|||
|
|
flattenStoreForInspectorTree(result, module._children[moduleName], filter, path + moduleName + "/");
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
function formatStoreForInspectorState(module, getters, path) {
|
|||
|
|
getters = path === "root" ? getters : getters[path];
|
|||
|
|
var gettersKeys = Object.keys(getters);
|
|||
|
|
var storeState = {
|
|||
|
|
state: Object.keys(module.state).map(function(key) {
|
|||
|
|
return {
|
|||
|
|
key,
|
|||
|
|
editable: true,
|
|||
|
|
value: module.state[key]
|
|||
|
|
};
|
|||
|
|
})
|
|||
|
|
};
|
|||
|
|
if (gettersKeys.length) {
|
|||
|
|
var tree = transformPathsToObjectTree(getters);
|
|||
|
|
storeState.getters = Object.keys(tree).map(function(key) {
|
|||
|
|
return {
|
|||
|
|
key: key.endsWith("/") ? extractNameFromPath(key) : key,
|
|||
|
|
editable: false,
|
|||
|
|
value: canThrow(function() {
|
|||
|
|
return tree[key];
|
|||
|
|
})
|
|||
|
|
};
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
return storeState;
|
|||
|
|
}
|
|||
|
|
function transformPathsToObjectTree(getters) {
|
|||
|
|
var result = {};
|
|||
|
|
Object.keys(getters).forEach(function(key) {
|
|||
|
|
var path = key.split("/");
|
|||
|
|
if (path.length > 1) {
|
|||
|
|
var target = result;
|
|||
|
|
var leafKey = path.pop();
|
|||
|
|
path.forEach(function(p) {
|
|||
|
|
if (!target[p]) {
|
|||
|
|
target[p] = {
|
|||
|
|
_custom: {
|
|||
|
|
value: {},
|
|||
|
|
display: p,
|
|||
|
|
tooltip: "Module",
|
|||
|
|
abstract: true
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
}
|
|||
|
|
target = target[p]._custom.value;
|
|||
|
|
});
|
|||
|
|
target[leafKey] = canThrow(function() {
|
|||
|
|
return getters[key];
|
|||
|
|
});
|
|||
|
|
} else {
|
|||
|
|
result[key] = canThrow(function() {
|
|||
|
|
return getters[key];
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
return result;
|
|||
|
|
}
|
|||
|
|
function getStoreModule(moduleMap, path) {
|
|||
|
|
var names = path.split("/").filter(function(n) {
|
|||
|
|
return n;
|
|||
|
|
});
|
|||
|
|
return names.reduce(
|
|||
|
|
function(module, moduleName, i) {
|
|||
|
|
var child = module[moduleName];
|
|||
|
|
if (!child) {
|
|||
|
|
throw new Error('Missing module "' + moduleName + '" for path "' + path + '".');
|
|||
|
|
}
|
|||
|
|
return i === names.length - 1 ? child : child._children;
|
|||
|
|
},
|
|||
|
|
path === "root" ? moduleMap : moduleMap.root._children
|
|||
|
|
);
|
|||
|
|
}
|
|||
|
|
function canThrow(cb) {
|
|||
|
|
try {
|
|||
|
|
return cb();
|
|||
|
|
} catch (e) {
|
|||
|
|
return e;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
var Module = function Module2(rawModule, runtime) {
|
|||
|
|
this.runtime = runtime;
|
|||
|
|
this._children = /* @__PURE__ */ Object.create(null);
|
|||
|
|
this._rawModule = rawModule;
|
|||
|
|
var rawState = rawModule.state;
|
|||
|
|
this.state = (typeof rawState === "function" ? rawState() : rawState) || {};
|
|||
|
|
};
|
|||
|
|
var prototypeAccessors$1 = { namespaced: { configurable: true } };
|
|||
|
|
prototypeAccessors$1.namespaced.get = function() {
|
|||
|
|
return !!this._rawModule.namespaced;
|
|||
|
|
};
|
|||
|
|
Module.prototype.addChild = function addChild(key, module) {
|
|||
|
|
this._children[key] = module;
|
|||
|
|
};
|
|||
|
|
Module.prototype.removeChild = function removeChild(key) {
|
|||
|
|
delete this._children[key];
|
|||
|
|
};
|
|||
|
|
Module.prototype.getChild = function getChild(key) {
|
|||
|
|
return this._children[key];
|
|||
|
|
};
|
|||
|
|
Module.prototype.hasChild = function hasChild(key) {
|
|||
|
|
return key in this._children;
|
|||
|
|
};
|
|||
|
|
Module.prototype.update = function update(rawModule) {
|
|||
|
|
this._rawModule.namespaced = rawModule.namespaced;
|
|||
|
|
if (rawModule.actions) {
|
|||
|
|
this._rawModule.actions = rawModule.actions;
|
|||
|
|
}
|
|||
|
|
if (rawModule.mutations) {
|
|||
|
|
this._rawModule.mutations = rawModule.mutations;
|
|||
|
|
}
|
|||
|
|
if (rawModule.getters) {
|
|||
|
|
this._rawModule.getters = rawModule.getters;
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
Module.prototype.forEachChild = function forEachChild(fn) {
|
|||
|
|
forEachValue(this._children, fn);
|
|||
|
|
};
|
|||
|
|
Module.prototype.forEachGetter = function forEachGetter(fn) {
|
|||
|
|
if (this._rawModule.getters) {
|
|||
|
|
forEachValue(this._rawModule.getters, fn);
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
Module.prototype.forEachAction = function forEachAction(fn) {
|
|||
|
|
if (this._rawModule.actions) {
|
|||
|
|
forEachValue(this._rawModule.actions, fn);
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
Module.prototype.forEachMutation = function forEachMutation(fn) {
|
|||
|
|
if (this._rawModule.mutations) {
|
|||
|
|
forEachValue(this._rawModule.mutations, fn);
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
Object.defineProperties(Module.prototype, prototypeAccessors$1);
|
|||
|
|
var ModuleCollection = function ModuleCollection2(rawRootModule) {
|
|||
|
|
this.register([], rawRootModule, false);
|
|||
|
|
};
|
|||
|
|
ModuleCollection.prototype.get = function get(path) {
|
|||
|
|
return path.reduce(function(module, key) {
|
|||
|
|
return module.getChild(key);
|
|||
|
|
}, this.root);
|
|||
|
|
};
|
|||
|
|
ModuleCollection.prototype.getNamespace = function getNamespace(path) {
|
|||
|
|
var module = this.root;
|
|||
|
|
return path.reduce(function(namespace, key) {
|
|||
|
|
module = module.getChild(key);
|
|||
|
|
return namespace + (module.namespaced ? key + "/" : "");
|
|||
|
|
}, "");
|
|||
|
|
};
|
|||
|
|
ModuleCollection.prototype.update = function update$1(rawRootModule) {
|
|||
|
|
update2([], this.root, rawRootModule);
|
|||
|
|
};
|
|||
|
|
ModuleCollection.prototype.register = function register(path, rawModule, runtime) {
|
|||
|
|
var this$1$1 = this;
|
|||
|
|
if (runtime === void 0)
|
|||
|
|
runtime = true;
|
|||
|
|
{
|
|||
|
|
assertRawModule(path, rawModule);
|
|||
|
|
}
|
|||
|
|
var newModule = new Module(rawModule, runtime);
|
|||
|
|
if (path.length === 0) {
|
|||
|
|
this.root = newModule;
|
|||
|
|
} else {
|
|||
|
|
var parent = this.get(path.slice(0, -1));
|
|||
|
|
parent.addChild(path[path.length - 1], newModule);
|
|||
|
|
}
|
|||
|
|
if (rawModule.modules) {
|
|||
|
|
forEachValue(rawModule.modules, function(rawChildModule, key) {
|
|||
|
|
this$1$1.register(path.concat(key), rawChildModule, runtime);
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
ModuleCollection.prototype.unregister = function unregister(path) {
|
|||
|
|
var parent = this.get(path.slice(0, -1));
|
|||
|
|
var key = path[path.length - 1];
|
|||
|
|
var child = parent.getChild(key);
|
|||
|
|
if (!child) {
|
|||
|
|
{
|
|||
|
|
console.warn(
|
|||
|
|
"[vuex] trying to unregister module '" + key + "', which is not registered"
|
|||
|
|
);
|
|||
|
|
}
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
if (!child.runtime) {
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
parent.removeChild(key);
|
|||
|
|
};
|
|||
|
|
ModuleCollection.prototype.isRegistered = function isRegistered(path) {
|
|||
|
|
var parent = this.get(path.slice(0, -1));
|
|||
|
|
var key = path[path.length - 1];
|
|||
|
|
if (parent) {
|
|||
|
|
return parent.hasChild(key);
|
|||
|
|
}
|
|||
|
|
return false;
|
|||
|
|
};
|
|||
|
|
function update2(path, targetModule, newModule) {
|
|||
|
|
{
|
|||
|
|
assertRawModule(path, newModule);
|
|||
|
|
}
|
|||
|
|
targetModule.update(newModule);
|
|||
|
|
if (newModule.modules) {
|
|||
|
|
for (var key in newModule.modules) {
|
|||
|
|
if (!targetModule.getChild(key)) {
|
|||
|
|
{
|
|||
|
|
console.warn(
|
|||
|
|
"[vuex] trying to add a new module '" + key + "' on hot reloading, manual reload is needed"
|
|||
|
|
);
|
|||
|
|
}
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
update2(
|
|||
|
|
path.concat(key),
|
|||
|
|
targetModule.getChild(key),
|
|||
|
|
newModule.modules[key]
|
|||
|
|
);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
var functionAssert = {
|
|||
|
|
assert: function(value) {
|
|||
|
|
return typeof value === "function";
|
|||
|
|
},
|
|||
|
|
expected: "function"
|
|||
|
|
};
|
|||
|
|
var objectAssert = {
|
|||
|
|
assert: function(value) {
|
|||
|
|
return typeof value === "function" || typeof value === "object" && typeof value.handler === "function";
|
|||
|
|
},
|
|||
|
|
expected: 'function or object with "handler" function'
|
|||
|
|
};
|
|||
|
|
var assertTypes = {
|
|||
|
|
getters: functionAssert,
|
|||
|
|
mutations: functionAssert,
|
|||
|
|
actions: objectAssert
|
|||
|
|
};
|
|||
|
|
function assertRawModule(path, rawModule) {
|
|||
|
|
Object.keys(assertTypes).forEach(function(key) {
|
|||
|
|
if (!rawModule[key]) {
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
var assertOptions = assertTypes[key];
|
|||
|
|
forEachValue(rawModule[key], function(value, type) {
|
|||
|
|
assert(
|
|||
|
|
assertOptions.assert(value),
|
|||
|
|
makeAssertionMessage(path, key, type, value, assertOptions.expected)
|
|||
|
|
);
|
|||
|
|
});
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
function makeAssertionMessage(path, key, type, value, expected) {
|
|||
|
|
var buf = key + " should be " + expected + ' but "' + key + "." + type + '"';
|
|||
|
|
if (path.length > 0) {
|
|||
|
|
buf += ' in module "' + path.join(".") + '"';
|
|||
|
|
}
|
|||
|
|
buf += " is " + JSON.stringify(value) + ".";
|
|||
|
|
return buf;
|
|||
|
|
}
|
|||
|
|
function createStore(options) {
|
|||
|
|
return new Store(options);
|
|||
|
|
}
|
|||
|
|
var Store = function Store2(options) {
|
|||
|
|
var this$1$1 = this;
|
|||
|
|
if (options === void 0)
|
|||
|
|
options = {};
|
|||
|
|
{
|
|||
|
|
assert(typeof Promise !== "undefined", "vuex requires a Promise polyfill in this browser.");
|
|||
|
|
assert(this instanceof Store2, "store must be called with the new operator.");
|
|||
|
|
}
|
|||
|
|
var plugins = options.plugins;
|
|||
|
|
if (plugins === void 0)
|
|||
|
|
plugins = [];
|
|||
|
|
var strict = options.strict;
|
|||
|
|
if (strict === void 0)
|
|||
|
|
strict = false;
|
|||
|
|
var devtools = options.devtools;
|
|||
|
|
this._committing = false;
|
|||
|
|
this._actions = /* @__PURE__ */ Object.create(null);
|
|||
|
|
this._actionSubscribers = [];
|
|||
|
|
this._mutations = /* @__PURE__ */ Object.create(null);
|
|||
|
|
this._wrappedGetters = /* @__PURE__ */ Object.create(null);
|
|||
|
|
this._modules = new ModuleCollection(options);
|
|||
|
|
this._modulesNamespaceMap = /* @__PURE__ */ Object.create(null);
|
|||
|
|
this._subscribers = [];
|
|||
|
|
this._makeLocalGettersCache = /* @__PURE__ */ Object.create(null);
|
|||
|
|
this._scope = null;
|
|||
|
|
this._devtools = devtools;
|
|||
|
|
var store2 = this;
|
|||
|
|
var ref = this;
|
|||
|
|
var dispatch2 = ref.dispatch;
|
|||
|
|
var commit2 = ref.commit;
|
|||
|
|
this.dispatch = function boundDispatch(type, payload) {
|
|||
|
|
return dispatch2.call(store2, type, payload);
|
|||
|
|
};
|
|||
|
|
this.commit = function boundCommit(type, payload, options2) {
|
|||
|
|
return commit2.call(store2, type, payload, options2);
|
|||
|
|
};
|
|||
|
|
this.strict = strict;
|
|||
|
|
var state = this._modules.root.state;
|
|||
|
|
installModule(this, state, [], this._modules.root);
|
|||
|
|
resetStoreState(this, state);
|
|||
|
|
plugins.forEach(function(plugin) {
|
|||
|
|
return plugin(this$1$1);
|
|||
|
|
});
|
|||
|
|
};
|
|||
|
|
var prototypeAccessors = { state: { configurable: true } };
|
|||
|
|
Store.prototype.install = function install(app, injectKey) {
|
|||
|
|
app.provide(injectKey || storeKey, this);
|
|||
|
|
app.config.globalProperties.$store = this;
|
|||
|
|
var useDevtools = this._devtools !== void 0 ? this._devtools : true;
|
|||
|
|
if (useDevtools) {
|
|||
|
|
addDevtools(app, this);
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
prototypeAccessors.state.get = function() {
|
|||
|
|
return this._state.data;
|
|||
|
|
};
|
|||
|
|
prototypeAccessors.state.set = function(v) {
|
|||
|
|
{
|
|||
|
|
assert(false, "use store.replaceState() to explicit replace store state.");
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
Store.prototype.commit = function commit(_type, _payload, _options) {
|
|||
|
|
var this$1$1 = this;
|
|||
|
|
var ref = unifyObjectStyle(_type, _payload, _options);
|
|||
|
|
var type = ref.type;
|
|||
|
|
var payload = ref.payload;
|
|||
|
|
var options = ref.options;
|
|||
|
|
var mutation = { type, payload };
|
|||
|
|
var entry = this._mutations[type];
|
|||
|
|
if (!entry) {
|
|||
|
|
{
|
|||
|
|
console.error("[vuex] unknown mutation type: " + type);
|
|||
|
|
}
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
this._withCommit(function() {
|
|||
|
|
entry.forEach(function commitIterator(handler) {
|
|||
|
|
handler(payload);
|
|||
|
|
});
|
|||
|
|
});
|
|||
|
|
this._subscribers.slice().forEach(function(sub) {
|
|||
|
|
return sub(mutation, this$1$1.state);
|
|||
|
|
});
|
|||
|
|
if (options && options.silent) {
|
|||
|
|
console.warn(
|
|||
|
|
"[vuex] mutation type: " + type + ". Silent option has been removed. Use the filter functionality in the vue-devtools"
|
|||
|
|
);
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
Store.prototype.dispatch = function dispatch(_type, _payload) {
|
|||
|
|
var this$1$1 = this;
|
|||
|
|
var ref = unifyObjectStyle(_type, _payload);
|
|||
|
|
var type = ref.type;
|
|||
|
|
var payload = ref.payload;
|
|||
|
|
var action = { type, payload };
|
|||
|
|
var entry = this._actions[type];
|
|||
|
|
if (!entry) {
|
|||
|
|
{
|
|||
|
|
console.error("[vuex] unknown action type: " + type);
|
|||
|
|
}
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
try {
|
|||
|
|
this._actionSubscribers.slice().filter(function(sub) {
|
|||
|
|
return sub.before;
|
|||
|
|
}).forEach(function(sub) {
|
|||
|
|
return sub.before(action, this$1$1.state);
|
|||
|
|
});
|
|||
|
|
} catch (e) {
|
|||
|
|
{
|
|||
|
|
console.warn("[vuex] error in before action subscribers: ");
|
|||
|
|
console.error(e);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
var result = entry.length > 1 ? Promise.all(entry.map(function(handler) {
|
|||
|
|
return handler(payload);
|
|||
|
|
})) : entry[0](payload);
|
|||
|
|
return new Promise(function(resolve, reject) {
|
|||
|
|
result.then(function(res) {
|
|||
|
|
try {
|
|||
|
|
this$1$1._actionSubscribers.filter(function(sub) {
|
|||
|
|
return sub.after;
|
|||
|
|
}).forEach(function(sub) {
|
|||
|
|
return sub.after(action, this$1$1.state);
|
|||
|
|
});
|
|||
|
|
} catch (e) {
|
|||
|
|
{
|
|||
|
|
console.warn("[vuex] error in after action subscribers: ");
|
|||
|
|
console.error(e);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
resolve(res);
|
|||
|
|
}, function(error) {
|
|||
|
|
try {
|
|||
|
|
this$1$1._actionSubscribers.filter(function(sub) {
|
|||
|
|
return sub.error;
|
|||
|
|
}).forEach(function(sub) {
|
|||
|
|
return sub.error(action, this$1$1.state, error);
|
|||
|
|
});
|
|||
|
|
} catch (e) {
|
|||
|
|
{
|
|||
|
|
console.warn("[vuex] error in error action subscribers: ");
|
|||
|
|
console.error(e);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
reject(error);
|
|||
|
|
});
|
|||
|
|
});
|
|||
|
|
};
|
|||
|
|
Store.prototype.subscribe = function subscribe(fn, options) {
|
|||
|
|
return genericSubscribe(fn, this._subscribers, options);
|
|||
|
|
};
|
|||
|
|
Store.prototype.subscribeAction = function subscribeAction(fn, options) {
|
|||
|
|
var subs = typeof fn === "function" ? { before: fn } : fn;
|
|||
|
|
return genericSubscribe(subs, this._actionSubscribers, options);
|
|||
|
|
};
|
|||
|
|
Store.prototype.watch = function watch$1(getter, cb, options) {
|
|||
|
|
var this$1$1 = this;
|
|||
|
|
{
|
|||
|
|
assert(typeof getter === "function", "store.watch only accepts a function.");
|
|||
|
|
}
|
|||
|
|
return vue.watch(function() {
|
|||
|
|
return getter(this$1$1.state, this$1$1.getters);
|
|||
|
|
}, cb, Object.assign({}, options));
|
|||
|
|
};
|
|||
|
|
Store.prototype.replaceState = function replaceState(state) {
|
|||
|
|
var this$1$1 = this;
|
|||
|
|
this._withCommit(function() {
|
|||
|
|
this$1$1._state.data = state;
|
|||
|
|
});
|
|||
|
|
};
|
|||
|
|
Store.prototype.registerModule = function registerModule(path, rawModule, options) {
|
|||
|
|
if (options === void 0)
|
|||
|
|
options = {};
|
|||
|
|
if (typeof path === "string") {
|
|||
|
|
path = [path];
|
|||
|
|
}
|
|||
|
|
{
|
|||
|
|
assert(Array.isArray(path), "module path must be a string or an Array.");
|
|||
|
|
assert(path.length > 0, "cannot register the root module by using registerModule.");
|
|||
|
|
}
|
|||
|
|
this._modules.register(path, rawModule);
|
|||
|
|
installModule(this, this.state, path, this._modules.get(path), options.preserveState);
|
|||
|
|
resetStoreState(this, this.state);
|
|||
|
|
};
|
|||
|
|
Store.prototype.unregisterModule = function unregisterModule(path) {
|
|||
|
|
var this$1$1 = this;
|
|||
|
|
if (typeof path === "string") {
|
|||
|
|
path = [path];
|
|||
|
|
}
|
|||
|
|
{
|
|||
|
|
assert(Array.isArray(path), "module path must be a string or an Array.");
|
|||
|
|
}
|
|||
|
|
this._modules.unregister(path);
|
|||
|
|
this._withCommit(function() {
|
|||
|
|
var parentState = getNestedState(this$1$1.state, path.slice(0, -1));
|
|||
|
|
delete parentState[path[path.length - 1]];
|
|||
|
|
});
|
|||
|
|
resetStore(this);
|
|||
|
|
};
|
|||
|
|
Store.prototype.hasModule = function hasModule(path) {
|
|||
|
|
if (typeof path === "string") {
|
|||
|
|
path = [path];
|
|||
|
|
}
|
|||
|
|
{
|
|||
|
|
assert(Array.isArray(path), "module path must be a string or an Array.");
|
|||
|
|
}
|
|||
|
|
return this._modules.isRegistered(path);
|
|||
|
|
};
|
|||
|
|
Store.prototype.hotUpdate = function hotUpdate(newOptions) {
|
|||
|
|
this._modules.update(newOptions);
|
|||
|
|
resetStore(this, true);
|
|||
|
|
};
|
|||
|
|
Store.prototype._withCommit = function _withCommit(fn) {
|
|||
|
|
var committing = this._committing;
|
|||
|
|
this._committing = true;
|
|||
|
|
fn();
|
|||
|
|
this._committing = committing;
|
|||
|
|
};
|
|||
|
|
Object.defineProperties(Store.prototype, prototypeAccessors);
|
|||
|
|
var mapState = normalizeNamespace(function(namespace, states) {
|
|||
|
|
var res = {};
|
|||
|
|
if (!isValidMap(states)) {
|
|||
|
|
console.error("[vuex] mapState: mapper parameter must be either an Array or an Object");
|
|||
|
|
}
|
|||
|
|
normalizeMap(states).forEach(function(ref) {
|
|||
|
|
var key = ref.key;
|
|||
|
|
var val = ref.val;
|
|||
|
|
res[key] = function mappedState() {
|
|||
|
|
var state = this.$store.state;
|
|||
|
|
var getters = this.$store.getters;
|
|||
|
|
if (namespace) {
|
|||
|
|
var module = getModuleByNamespace(this.$store, "mapState", namespace);
|
|||
|
|
if (!module) {
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
state = module.context.state;
|
|||
|
|
getters = module.context.getters;
|
|||
|
|
}
|
|||
|
|
return typeof val === "function" ? val.call(this, state, getters) : state[val];
|
|||
|
|
};
|
|||
|
|
res[key].vuex = true;
|
|||
|
|
});
|
|||
|
|
return res;
|
|||
|
|
});
|
|||
|
|
var mapMutations = normalizeNamespace(function(namespace, mutations) {
|
|||
|
|
var res = {};
|
|||
|
|
if (!isValidMap(mutations)) {
|
|||
|
|
console.error("[vuex] mapMutations: mapper parameter must be either an Array or an Object");
|
|||
|
|
}
|
|||
|
|
normalizeMap(mutations).forEach(function(ref) {
|
|||
|
|
var key = ref.key;
|
|||
|
|
var val = ref.val;
|
|||
|
|
res[key] = function mappedMutation() {
|
|||
|
|
var args = [], len = arguments.length;
|
|||
|
|
while (len--)
|
|||
|
|
args[len] = arguments[len];
|
|||
|
|
var commit2 = this.$store.commit;
|
|||
|
|
if (namespace) {
|
|||
|
|
var module = getModuleByNamespace(this.$store, "mapMutations", namespace);
|
|||
|
|
if (!module) {
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
commit2 = module.context.commit;
|
|||
|
|
}
|
|||
|
|
return typeof val === "function" ? val.apply(this, [commit2].concat(args)) : commit2.apply(this.$store, [val].concat(args));
|
|||
|
|
};
|
|||
|
|
});
|
|||
|
|
return res;
|
|||
|
|
});
|
|||
|
|
function normalizeMap(map) {
|
|||
|
|
if (!isValidMap(map)) {
|
|||
|
|
return [];
|
|||
|
|
}
|
|||
|
|
return Array.isArray(map) ? map.map(function(key) {
|
|||
|
|
return { key, val: key };
|
|||
|
|
}) : Object.keys(map).map(function(key) {
|
|||
|
|
return { key, val: map[key] };
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
function isValidMap(map) {
|
|||
|
|
return Array.isArray(map) || isObject(map);
|
|||
|
|
}
|
|||
|
|
function normalizeNamespace(fn) {
|
|||
|
|
return function(namespace, map) {
|
|||
|
|
if (typeof namespace !== "string") {
|
|||
|
|
map = namespace;
|
|||
|
|
namespace = "";
|
|||
|
|
} else if (namespace.charAt(namespace.length - 1) !== "/") {
|
|||
|
|
namespace += "/";
|
|||
|
|
}
|
|||
|
|
return fn(namespace, map);
|
|||
|
|
};
|
|||
|
|
}
|
|||
|
|
function getModuleByNamespace(store2, helper, namespace) {
|
|||
|
|
var module = store2._modulesNamespaceMap[namespace];
|
|||
|
|
if (!module) {
|
|||
|
|
console.error("[vuex] module namespace not found in " + helper + "(): " + namespace);
|
|||
|
|
}
|
|||
|
|
return module;
|
|||
|
|
}
|
|||
|
|
const _export_sfc = (sfc, props) => {
|
|||
|
|
const target = sfc.__vccOpts || sfc;
|
|||
|
|
for (const [key, val] of props) {
|
|||
|
|
target[key] = val;
|
|||
|
|
}
|
|||
|
|
return target;
|
|||
|
|
};
|
|||
|
|
const _sfc_main$c = {
|
|||
|
|
data() {
|
|||
|
|
return {
|
|||
|
|
images: [
|
|||
|
|
["/static/image/collected.png", "/static/image/collected1.png"],
|
|||
|
|
["/static/image/favicon.png", "/static/image/favicon1.png"],
|
|||
|
|
["/static/image/freeok.png", "/static/image/freeok1.png"],
|
|||
|
|
["/static/image/fullscreen.png", "/static/image/fullscreen1.png"]
|
|||
|
|
],
|
|||
|
|
// 每个卡片当前是否显示第二张图
|
|||
|
|
isFlipped: [false, false, false, false],
|
|||
|
|
transitionClass: "fade"
|
|||
|
|
};
|
|||
|
|
},
|
|||
|
|
methods: {
|
|||
|
|
...mapMutations(["showPage"]),
|
|||
|
|
async pageBack(e) {
|
|||
|
|
uni.showModal({
|
|||
|
|
title: "提示",
|
|||
|
|
content: "是否退出",
|
|||
|
|
success: (res) => {
|
|||
|
|
if (res.confirm) {
|
|||
|
|
formatAppLog("log", "at pages/index/index.vue:39", "用户点击确定");
|
|||
|
|
plus.runtime.quit();
|
|||
|
|
} else if (res.cancel) {
|
|||
|
|
formatAppLog("log", "at pages/index/index.vue:42", "用户点击取消");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
async mounted() {
|
|||
|
|
const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|||
|
|
while (true) {
|
|||
|
|
for (let i = 0; i < this.images.length; i++) {
|
|||
|
|
this.$set(this.isFlipped, i, true);
|
|||
|
|
await delay(1e3);
|
|||
|
|
}
|
|||
|
|
await delay(2e3);
|
|||
|
|
for (let i = 0; i < this.images.length; i++) {
|
|||
|
|
this.$set(this.isFlipped, i, false);
|
|||
|
|
await delay(1e3);
|
|||
|
|
}
|
|||
|
|
await delay(2e3);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
|
|||
|
|
return vue.openBlock(), vue.createElementBlock(
|
|||
|
|
"div",
|
|||
|
|
{
|
|||
|
|
class: "container",
|
|||
|
|
onBack: _cache[0] || (_cache[0] = (...args) => $options.pageBack && $options.pageBack(...args))
|
|||
|
|
},
|
|||
|
|
[
|
|||
|
|
vue.createElementVNode("div", { class: "grid-container" }, [
|
|||
|
|
(vue.openBlock(true), vue.createElementBlock(
|
|||
|
|
vue.Fragment,
|
|||
|
|
null,
|
|||
|
|
vue.renderList($data.images, (item, index) => {
|
|||
|
|
return vue.openBlock(), vue.createElementBlock(
|
|||
|
|
"div",
|
|||
|
|
{
|
|||
|
|
key: index,
|
|||
|
|
class: vue.normalizeClass(["grid-item", { flipped: $data.isFlipped[index] }])
|
|||
|
|
},
|
|||
|
|
[
|
|||
|
|
vue.createElementVNode("image", {
|
|||
|
|
class: "img-front",
|
|||
|
|
src: item[0],
|
|||
|
|
alt: ""
|
|||
|
|
}, null, 8, ["src"]),
|
|||
|
|
vue.createElementVNode("image", {
|
|||
|
|
class: "img-back",
|
|||
|
|
src: item[1],
|
|||
|
|
alt: ""
|
|||
|
|
}, null, 8, ["src"])
|
|||
|
|
],
|
|||
|
|
2
|
|||
|
|
/* CLASS */
|
|||
|
|
);
|
|||
|
|
}),
|
|||
|
|
128
|
|||
|
|
/* KEYED_FRAGMENT */
|
|||
|
|
))
|
|||
|
|
])
|
|||
|
|
],
|
|||
|
|
32
|
|||
|
|
/* NEED_HYDRATION */
|
|||
|
|
);
|
|||
|
|
}
|
|||
|
|
const PagesIndexIndex = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["render", _sfc_render$b], ["__file", "/Users/yunzhi/Projects/TV/电视TV影视APP/pages/index/index.vue"]]);
|
|||
|
|
const _sfc_main$b = {
|
|||
|
|
data() {
|
|||
|
|
return {
|
|||
|
|
updateTime: Date.now() / 1e3,
|
|||
|
|
version: "1.0.0",
|
|||
|
|
//当前运行版本(打包时manifest里的版本名称)
|
|||
|
|
percent: 0,
|
|||
|
|
//进度条百分比
|
|||
|
|
updateBtn: false,
|
|||
|
|
//是否显示立即更新
|
|||
|
|
cancleBtn: false,
|
|||
|
|
//是否显示取消按钮
|
|||
|
|
downloadedSize: 0,
|
|||
|
|
//当前已下载大小
|
|||
|
|
packageFileSize: 0,
|
|||
|
|
//安装包大小
|
|||
|
|
data: {
|
|||
|
|
describe: "1. 修复已知问题<br>2. 优化用户体验",
|
|||
|
|
edition_url: "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-6bef1fe3-e3e3-4909-9f0c-6ed9bd11c93b/aae2360a-6628-4c93-b873-ce1600b9a852.apk",
|
|||
|
|
//安装包下载地址或者通用应用市场地址
|
|||
|
|
edition_force: 1,
|
|||
|
|
//是否强制更新 0代表否 1代表是
|
|||
|
|
package_type: 0,
|
|||
|
|
//0是整包升级 1是wgt升级
|
|||
|
|
edition_name: "1.0.1"
|
|||
|
|
//后端返回的版本名称
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
},
|
|||
|
|
onHide() {
|
|||
|
|
this.data.edition_force = 0;
|
|||
|
|
uni.navigateBack({
|
|||
|
|
delta: 1
|
|||
|
|
});
|
|||
|
|
},
|
|||
|
|
onLoad({ obj }) {
|
|||
|
|
this.data = JSON.parse(obj);
|
|||
|
|
if (this.data.edition_force == 0) {
|
|||
|
|
this.cancleBtn = true;
|
|||
|
|
}
|
|||
|
|
plus.runtime.getProperty(plus.runtime.appid, (inf) => {
|
|||
|
|
this.version = inf.version;
|
|||
|
|
});
|
|||
|
|
},
|
|||
|
|
onShow() {
|
|||
|
|
this.confirm();
|
|||
|
|
},
|
|||
|
|
onBackPress() {
|
|||
|
|
if (this.data.edition_force == 1) {
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
methods: {
|
|||
|
|
cancel() {
|
|||
|
|
uni.navigateBack({
|
|||
|
|
delta: 1
|
|||
|
|
});
|
|||
|
|
},
|
|||
|
|
confirm() {
|
|||
|
|
if (this.data.package_type == 0) {
|
|||
|
|
if (this.data.edition_url.includes(".apk")) {
|
|||
|
|
this.updateBtn = false;
|
|||
|
|
this.cancleBtn = false;
|
|||
|
|
this.download();
|
|||
|
|
} else {
|
|||
|
|
this.data.edition_force = 0;
|
|||
|
|
plus.runtime.openURL(this.data.edition_url);
|
|||
|
|
uni.navigateBack({
|
|||
|
|
delta: 1
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
} else {
|
|||
|
|
this.updateBtn = false;
|
|||
|
|
this.cancleBtn = false;
|
|||
|
|
this.download();
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
download() {
|
|||
|
|
let package_type = this.data.package_type;
|
|||
|
|
let that = this;
|
|||
|
|
const downloadTask = uni.downloadFile({
|
|||
|
|
url: this.data.edition_url,
|
|||
|
|
success: (res) => {
|
|||
|
|
if (res.statusCode === 200) {
|
|||
|
|
this.percent = 100;
|
|||
|
|
uni.showToast({
|
|||
|
|
title: "下载完成",
|
|||
|
|
icon: "none",
|
|||
|
|
duration: 2500
|
|||
|
|
});
|
|||
|
|
plus.runtime.install(
|
|||
|
|
res.tempFilePath,
|
|||
|
|
{
|
|||
|
|
force: true
|
|||
|
|
//true表示强制安装,不进行版本号的校验;false则需要版本号校验,
|
|||
|
|
},
|
|||
|
|
function() {
|
|||
|
|
formatAppLog("log", "at uni_modules/rt-uni-update/components/rt-uni-update/rt-uni-update.vue:112", "success", success);
|
|||
|
|
uni.showToast({
|
|||
|
|
title: "下载完成2",
|
|||
|
|
icon: "none",
|
|||
|
|
duration: 2500
|
|||
|
|
});
|
|||
|
|
if (package_type == 1) {
|
|||
|
|
plus.runtime.restart();
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
function(e) {
|
|||
|
|
that.data.edition_force = 0;
|
|||
|
|
uni.showToast({
|
|||
|
|
title: e.message,
|
|||
|
|
icon: "none",
|
|||
|
|
duration: 2500
|
|||
|
|
});
|
|||
|
|
setTimeout(() => {
|
|||
|
|
uni.navigateBack();
|
|||
|
|
}, 2e3);
|
|||
|
|
}
|
|||
|
|
);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
downloadTask.onProgressUpdate((res) => {
|
|||
|
|
if (this.percent != res.progress) {
|
|||
|
|
let updateTime2 = Date.now() / 1e3;
|
|||
|
|
if (updateTime2 - this.updateTime > 2) {
|
|||
|
|
this.updateTime = updateTime2;
|
|||
|
|
this.downloadedSize = (res.totalBytesWritten / Math.pow(1024, 2)).toFixed(2);
|
|||
|
|
this.packageFileSize = (res.totalBytesExpectedToWrite / Math.pow(1024, 2)).toFixed(2);
|
|||
|
|
this.percent = res.progress;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
|
|||
|
|
return vue.openBlock(), vue.createElementBlock("view", { class: "update-mask flex-center" }, [
|
|||
|
|
vue.createElementVNode("view", { class: "content botton-radius" }, [
|
|||
|
|
vue.createElementVNode("view", { class: "content-body botton-radius" }, [
|
|||
|
|
vue.createElementVNode("view", {
|
|||
|
|
class: "title",
|
|||
|
|
style: { "padding-top": "20rpx" }
|
|||
|
|
}, [
|
|||
|
|
vue.createElementVNode(
|
|||
|
|
"text",
|
|||
|
|
null,
|
|||
|
|
"更新内容" + vue.toDisplayString($data.downloadedSize) + "-" + vue.toDisplayString($data.packageFileSize),
|
|||
|
|
1
|
|||
|
|
/* TEXT */
|
|||
|
|
)
|
|||
|
|
]),
|
|||
|
|
vue.createElementVNode("view", { class: "body" }, [
|
|||
|
|
vue.createElementVNode("scroll-view", {
|
|||
|
|
class: "box-des-scroll",
|
|||
|
|
"scroll-y": "true"
|
|||
|
|
}, [
|
|||
|
|
vue.createElementVNode("rich-text", {
|
|||
|
|
nodes: $data.data.describe
|
|||
|
|
}, null, 8, ["nodes"])
|
|||
|
|
])
|
|||
|
|
]),
|
|||
|
|
vue.createElementVNode("view", { class: "footer flex-center" }, [
|
|||
|
|
!$data.updateBtn ? (vue.openBlock(), vue.createElementBlock("view", {
|
|||
|
|
key: 0,
|
|||
|
|
class: "progress-box flex-column"
|
|||
|
|
}, [
|
|||
|
|
vue.createElementVNode("progress", {
|
|||
|
|
class: "progress",
|
|||
|
|
"border-radius": "35",
|
|||
|
|
percent: $data.percent,
|
|||
|
|
activeColor: "#3DA7FF",
|
|||
|
|
"show-info": "",
|
|||
|
|
"stroke-width": "10"
|
|||
|
|
}, null, 8, ["percent"])
|
|||
|
|
])) : vue.createCommentVNode("v-if", true)
|
|||
|
|
])
|
|||
|
|
])
|
|||
|
|
])
|
|||
|
|
]);
|
|||
|
|
}
|
|||
|
|
const UniModulesRtUniUpdateComponentsRtUniUpdateRtUniUpdate = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["render", _sfc_render$a], ["__file", "/Users/yunzhi/Projects/TV/电视TV影视APP/uni_modules/rt-uni-update/components/rt-uni-update/rt-uni-update.vue"]]);
|
|||
|
|
const _imports_0$1 = "/static/play.png";
|
|||
|
|
const _sfc_main$a = {
|
|||
|
|
inject: ["pageId", "pageState"],
|
|||
|
|
watch: {},
|
|||
|
|
props: {
|
|||
|
|
clazz: {
|
|||
|
|
type: String
|
|||
|
|
},
|
|||
|
|
src: {
|
|||
|
|
type: String
|
|||
|
|
},
|
|||
|
|
autoplay: {
|
|||
|
|
type: Boolean,
|
|||
|
|
default: true
|
|||
|
|
},
|
|||
|
|
showProgress: {
|
|||
|
|
type: Boolean,
|
|||
|
|
default: false
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
data() {
|
|||
|
|
return {
|
|||
|
|
status: 0,
|
|||
|
|
currentTime: 0,
|
|||
|
|
fullScreen: false
|
|||
|
|
};
|
|||
|
|
},
|
|||
|
|
created() {
|
|||
|
|
this.viderContext = uni.createVideoContext("player");
|
|||
|
|
uni.$on("keyDown", (data) => {
|
|||
|
|
this.keyDown(data);
|
|||
|
|
});
|
|||
|
|
},
|
|||
|
|
methods: {
|
|||
|
|
keyDown(Arrow) {
|
|||
|
|
formatAppLog("log", "at components/unitv-video/unitv-video.vue:46", "监测到按键:" + Arrow);
|
|||
|
|
switch (Arrow) {
|
|||
|
|
case "KeyLeft":
|
|||
|
|
{
|
|||
|
|
var time = parseInt(this.currentTime - 15, 10);
|
|||
|
|
this.viderContext.seek(time < 0 ? 0 : time);
|
|||
|
|
}
|
|||
|
|
break;
|
|||
|
|
case "KeyRight":
|
|||
|
|
{
|
|||
|
|
var time = parseInt(this.currentTime + 15, 10);
|
|||
|
|
this.viderContext.seek(time);
|
|||
|
|
}
|
|||
|
|
break;
|
|||
|
|
case "KeyEnter":
|
|||
|
|
{
|
|||
|
|
this.clickVideo();
|
|||
|
|
}
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
clickVideo() {
|
|||
|
|
if (this.status) {
|
|||
|
|
this.viderContext.pause();
|
|||
|
|
this.viderContext.showStatusBar();
|
|||
|
|
} else {
|
|||
|
|
this.viderContext.play();
|
|||
|
|
this.viderContext.hideStatusBar();
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
timeupdate: function(e) {
|
|||
|
|
this.currentTime = e.detail.currentTime;
|
|||
|
|
},
|
|||
|
|
fullscreenchange: function(e) {
|
|||
|
|
this.fullScreen = e.detail.fullScreen;
|
|||
|
|
this.pageState.handleEvent = e.detail.fullScreen;
|
|||
|
|
if (this.fullScreen) {
|
|||
|
|
this.viderContext.play();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
|
|||
|
|
return vue.openBlock(), vue.createElementBlock("video", {
|
|||
|
|
id: "player",
|
|||
|
|
class: vue.normalizeClass($props.clazz),
|
|||
|
|
src: $props.src,
|
|||
|
|
autoplay: $props.autoplay,
|
|||
|
|
"enable-play-gesture": false,
|
|||
|
|
"enable-progress-gesture": false,
|
|||
|
|
"show-center-play-btn": false,
|
|||
|
|
"show-progress": true,
|
|||
|
|
onPlay: _cache[0] || (_cache[0] = ($event) => $data.status = 1),
|
|||
|
|
onPause: _cache[1] || (_cache[1] = ($event) => $data.status = 0),
|
|||
|
|
onTimeupdate: _cache[2] || (_cache[2] = (...args) => $options.timeupdate && $options.timeupdate(...args)),
|
|||
|
|
onFullscreenchange: _cache[3] || (_cache[3] = (...args) => $options.fullscreenchange && $options.fullscreenchange(...args))
|
|||
|
|
}, [
|
|||
|
|
$data.status == 0 ? (vue.openBlock(), vue.createElementBlock("cover-image", {
|
|||
|
|
key: 0,
|
|||
|
|
class: "controls-play img",
|
|||
|
|
src: _imports_0$1
|
|||
|
|
})) : vue.createCommentVNode("v-if", true)
|
|||
|
|
], 42, ["src", "autoplay"]);
|
|||
|
|
}
|
|||
|
|
const __easycom_0$2 = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["render", _sfc_render$9], ["__scopeId", "data-v-59a00a59"], ["__file", "/Users/yunzhi/Projects/TV/电视TV影视APP/components/unitv-video/unitv-video.vue"]]);
|
|||
|
|
const _sfc_main$9 = {
|
|||
|
|
name: "unitvPage",
|
|||
|
|
inject: ["pageId", "zoneId", "zoneState", "zoneItems"],
|
|||
|
|
props: {
|
|||
|
|
item: {
|
|||
|
|
type: Number
|
|||
|
|
},
|
|||
|
|
hoverClass: {
|
|||
|
|
type: String,
|
|||
|
|
default: "item-hover"
|
|||
|
|
},
|
|||
|
|
selectClass: {
|
|||
|
|
type: String,
|
|||
|
|
default: "item-active"
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
updated() {
|
|||
|
|
this.zoneItems[this.item] = this;
|
|||
|
|
},
|
|||
|
|
created() {
|
|||
|
|
this.zoneItems[this.item] = this;
|
|||
|
|
},
|
|||
|
|
mounted() {
|
|||
|
|
if (this.zoneState.curZone && this.zoneState.curItem == this.item) {
|
|||
|
|
this.handleHover();
|
|||
|
|
this.refreshScroll();
|
|||
|
|
this.refreshState();
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
data() {
|
|||
|
|
return {
|
|||
|
|
selected: false,
|
|||
|
|
hovered: false
|
|||
|
|
};
|
|||
|
|
},
|
|||
|
|
computed: {
|
|||
|
|
...mapState(["currentZone", "currentPage"]),
|
|||
|
|
id: function() {
|
|||
|
|
return this.zoneId + "_" + this.item;
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
methods: {
|
|||
|
|
clientRect(callback) {
|
|||
|
|
let view = uni.createSelectorQuery().in(this).select("#" + this.id);
|
|||
|
|
view.boundingClientRect((data) => {
|
|||
|
|
callback(data);
|
|||
|
|
}).exec();
|
|||
|
|
},
|
|||
|
|
refreshScroll() {
|
|||
|
|
this.clientRect((clientRect) => {
|
|||
|
|
this.currentPage.RefreshScrollTop(clientRect);
|
|||
|
|
if (this.zoneState.curScroll != null) {
|
|||
|
|
this.zoneState.curScroll.RefreshScrollLeft(clientRect);
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
},
|
|||
|
|
refreshState() {
|
|||
|
|
if (!this.zoneState.curZone && this.zoneState.curItem == this.item) {
|
|||
|
|
this.selected = true;
|
|||
|
|
} else {
|
|||
|
|
this.selected = false;
|
|||
|
|
}
|
|||
|
|
if (this.zoneState.curZone && this.zoneState.curItem == this.item) {
|
|||
|
|
this.hovered = true;
|
|||
|
|
} else {
|
|||
|
|
this.hovered = false;
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
handleHover() {
|
|||
|
|
this.$emit("hover", this.item);
|
|||
|
|
},
|
|||
|
|
handleClick() {
|
|||
|
|
this.$emit("click", this.item);
|
|||
|
|
},
|
|||
|
|
handleDel() {
|
|||
|
|
this.$emit("del", this.item);
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
watch: {
|
|||
|
|
hovered: function(newValue) {
|
|||
|
|
if (newValue != "") {
|
|||
|
|
this.handleHover();
|
|||
|
|
this.refreshScroll();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
|
|||
|
|
return vue.openBlock(), vue.createElementBlock("view", {
|
|||
|
|
id: $options.id,
|
|||
|
|
class: vue.normalizeClass(`${$data.selected ? $props.selectClass : ""} ${$data.hovered ? $props.hoverClass : ""}`)
|
|||
|
|
}, [
|
|||
|
|
vue.renderSlot(_ctx.$slots, "default")
|
|||
|
|
], 10, ["id"]);
|
|||
|
|
}
|
|||
|
|
const __easycom_0$1 = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["render", _sfc_render$8], ["__file", "/Users/yunzhi/Projects/TV/电视TV影视APP/components/unitv-item/unitv-item.vue"]]);
|
|||
|
|
const _sfc_main$8 = {
|
|||
|
|
name: "unitvPage",
|
|||
|
|
inject: ["pageId", "pageState"],
|
|||
|
|
props: {
|
|||
|
|
id: {
|
|||
|
|
// Zone Id
|
|||
|
|
type: String,
|
|||
|
|
required: true
|
|||
|
|
},
|
|||
|
|
up: {
|
|||
|
|
// Zone切换时上一Zone Id
|
|||
|
|
type: String
|
|||
|
|
},
|
|||
|
|
down: {
|
|||
|
|
// Zone切换时下一Zone Id
|
|||
|
|
type: String
|
|||
|
|
},
|
|||
|
|
left: {
|
|||
|
|
// Zone切换时左一Zone Id
|
|||
|
|
type: String
|
|||
|
|
},
|
|||
|
|
right: {
|
|||
|
|
// Zone切换时右一Zone Id
|
|||
|
|
type: String
|
|||
|
|
},
|
|||
|
|
item: {
|
|||
|
|
// Zone当前焦点item索引
|
|||
|
|
type: Number,
|
|||
|
|
default: 0
|
|||
|
|
},
|
|||
|
|
prevZone: {
|
|||
|
|
// Zone改变后的上一个Zone Id
|
|||
|
|
type: String
|
|||
|
|
},
|
|||
|
|
row: {
|
|||
|
|
// Zone的item总行数
|
|||
|
|
type: Number,
|
|||
|
|
default: 1
|
|||
|
|
},
|
|||
|
|
column: {
|
|||
|
|
// Zone的item总列数
|
|||
|
|
type: Number,
|
|||
|
|
default: 1
|
|||
|
|
},
|
|||
|
|
defaultBehavior: {
|
|||
|
|
type: Boolean,
|
|||
|
|
default: true
|
|||
|
|
},
|
|||
|
|
autoFous: {
|
|||
|
|
type: Boolean,
|
|||
|
|
default: false
|
|||
|
|
},
|
|||
|
|
values: {
|
|||
|
|
type: Array,
|
|||
|
|
default: () => []
|
|||
|
|
},
|
|||
|
|
count: {
|
|||
|
|
type: Number,
|
|||
|
|
default: 0
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
provide() {
|
|||
|
|
return {
|
|||
|
|
zoneId: this.id,
|
|||
|
|
zoneState: this.zoneState,
|
|||
|
|
zoneItems: this.items
|
|||
|
|
};
|
|||
|
|
},
|
|||
|
|
created() {
|
|||
|
|
if (this.autoFous) {
|
|||
|
|
this.pageState.curZoneId = this.id;
|
|||
|
|
this.zoneState.curZone = true;
|
|||
|
|
this.focus = true;
|
|||
|
|
this.switchZone(this);
|
|||
|
|
}
|
|||
|
|
this._switchItem(this.item);
|
|||
|
|
this.currentPage.pushZone(this);
|
|||
|
|
},
|
|||
|
|
mounted() {
|
|||
|
|
},
|
|||
|
|
computed: {
|
|||
|
|
...mapState(["currentZone", "currentPage"]),
|
|||
|
|
size: function() {
|
|||
|
|
if (this.count != 0) {
|
|||
|
|
return this.count;
|
|||
|
|
} else if (this.values.length != 0) {
|
|||
|
|
return this.values.length;
|
|||
|
|
} else {
|
|||
|
|
return this.items.length;
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
rows: function() {
|
|||
|
|
if (this.row > 1) {
|
|||
|
|
return this.row;
|
|||
|
|
}
|
|||
|
|
return Math.ceil(this.size / this.column);
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
data() {
|
|||
|
|
return {
|
|||
|
|
citem: 0,
|
|||
|
|
crow: 0,
|
|||
|
|
// Zone的当前行
|
|||
|
|
prevItem: 0,
|
|||
|
|
// item改变后的上一item索引
|
|||
|
|
focus: false,
|
|||
|
|
items: [],
|
|||
|
|
// Zone的所有item数组集合
|
|||
|
|
zoneState: {
|
|||
|
|
curItem: this.citem,
|
|||
|
|
curZone: this.focus,
|
|||
|
|
curScroll: null
|
|||
|
|
},
|
|||
|
|
StepSeq: 0
|
|||
|
|
};
|
|||
|
|
},
|
|||
|
|
methods: {
|
|||
|
|
...mapMutations(["switchZone"]),
|
|||
|
|
_switchItem: function(item, oldItem) {
|
|||
|
|
this.citem = item;
|
|||
|
|
this.zoneState.curItem = item;
|
|||
|
|
try {
|
|||
|
|
this.refreshItem();
|
|||
|
|
if (oldItem != void 0) {
|
|||
|
|
this.items[oldItem].refreshState();
|
|||
|
|
}
|
|||
|
|
} catch (e) {
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
refreshItem: function() {
|
|||
|
|
this.items[this.citem].refreshState();
|
|||
|
|
},
|
|||
|
|
evtArrow: function(Arrow) {
|
|||
|
|
var self = this;
|
|||
|
|
var oldItem = this.citem || 0;
|
|||
|
|
var item = this.citem || 0;
|
|||
|
|
var steps = this.rows * this.column;
|
|||
|
|
var Row = Math.floor(item / this.column);
|
|||
|
|
var Border = this[Arrow];
|
|||
|
|
var cRow = this.crow;
|
|||
|
|
switch (Arrow) {
|
|||
|
|
case "left":
|
|||
|
|
item -= 1;
|
|||
|
|
if (Math.floor(item / this.column) != Row) {
|
|||
|
|
item = item - steps;
|
|||
|
|
}
|
|||
|
|
break;
|
|||
|
|
case "right":
|
|||
|
|
item += 1;
|
|||
|
|
if (Math.floor(item / this.column) != Row) {
|
|||
|
|
item = item + steps;
|
|||
|
|
}
|
|||
|
|
break;
|
|||
|
|
case "up":
|
|||
|
|
item -= this.column;
|
|||
|
|
this.crow = cRow - 1;
|
|||
|
|
break;
|
|||
|
|
case "down":
|
|||
|
|
item += this.column;
|
|||
|
|
this.crow = cRow + 1;
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
if (item >= 0 && item <= steps - 1) {
|
|||
|
|
if (item + this.StepSeq * steps + 1 > this.size) {
|
|||
|
|
item = this.size - this.StepSeq * steps - 1;
|
|||
|
|
}
|
|||
|
|
this.citem = item;
|
|||
|
|
this._switchItem(this.citem, oldItem);
|
|||
|
|
if (this.crow === this.rows - 1) {
|
|||
|
|
this.$emit("scrolltolower");
|
|||
|
|
}
|
|||
|
|
} else {
|
|||
|
|
this.crow = cRow;
|
|||
|
|
OverBorder();
|
|||
|
|
}
|
|||
|
|
function OverBorder() {
|
|||
|
|
if (Border) {
|
|||
|
|
if (Border === self.id) {
|
|||
|
|
ScrollItem();
|
|||
|
|
} else {
|
|||
|
|
ChangeZone();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
function ScrollItem() {
|
|||
|
|
switch (Arrow) {
|
|||
|
|
case "up":
|
|||
|
|
item = self.citem + self.column * (self.rows - 1);
|
|||
|
|
self.crow = self.rows - 1;
|
|||
|
|
break;
|
|||
|
|
case "down":
|
|||
|
|
item = self.citem - self.column * (self.rows - 1);
|
|||
|
|
self.crow = 0;
|
|||
|
|
break;
|
|||
|
|
case "left":
|
|||
|
|
item = (Row + 1) * self.column - 1;
|
|||
|
|
break;
|
|||
|
|
case "right":
|
|||
|
|
item = Row * self.column;
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
if (self.size > steps) {
|
|||
|
|
self.StepSeq = self.StepSeq || 0;
|
|||
|
|
var MaxSeq = Math.ceil(self.size / steps) - 1;
|
|||
|
|
if (Arrow === "left" || Arrow === "up") {
|
|||
|
|
self.StepSeq = self.StepSeq > 0 ? self.StepSeq - 1 : MaxSeq;
|
|||
|
|
} else if (Arrow === "right" || Arrow === "down") {
|
|||
|
|
self.StepSeq = self.StepSeq < MaxSeq ? self.StepSeq + 1 : 0;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
if (item + self.StepSeq * steps + 1 > self.size) {
|
|||
|
|
item = 0;
|
|||
|
|
}
|
|||
|
|
self.citem = item;
|
|||
|
|
self._switchItem(self.citem, oldItem);
|
|||
|
|
}
|
|||
|
|
function ChangeZone() {
|
|||
|
|
self.currentPage.ChangeZone(Border);
|
|||
|
|
self.refreshItem();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
evtEnter: function() {
|
|||
|
|
var itemObj = this.items[this.citem];
|
|||
|
|
if (itemObj) {
|
|||
|
|
itemObj.handleClick();
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
evtDel: function() {
|
|||
|
|
var itemObj = this.items[this.citem];
|
|||
|
|
if (itemObj) {
|
|||
|
|
itemObj.handleDel();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
watch: {
|
|||
|
|
values: function(newVal, oldVal) {
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
|
|||
|
|
return vue.openBlock(), vue.createElementBlock("view", { id: $props.id }, [
|
|||
|
|
vue.renderSlot(_ctx.$slots, "default")
|
|||
|
|
], 8, ["id"]);
|
|||
|
|
}
|
|||
|
|
const __easycom_1$1 = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["render", _sfc_render$7], ["__file", "/Users/yunzhi/Projects/TV/电视TV影视APP/components/unitv-zone/unitv-zone.vue"]]);
|
|||
|
|
const _sfc_main$7 = {
|
|||
|
|
inject: ["pageId", "zoneId", "zoneState"],
|
|||
|
|
watch: {},
|
|||
|
|
data() {
|
|||
|
|
return {
|
|||
|
|
scrollLeft: 0,
|
|||
|
|
old: {
|
|||
|
|
scrollLeft: 0
|
|||
|
|
},
|
|||
|
|
windowWidth: null
|
|||
|
|
};
|
|||
|
|
},
|
|||
|
|
created() {
|
|||
|
|
this.zoneState.curScroll = this;
|
|||
|
|
uni.getSystemInfo({
|
|||
|
|
success: (res) => {
|
|||
|
|
this.windowWidth = res.windowWidth;
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
},
|
|||
|
|
methods: {
|
|||
|
|
scroll: function(e) {
|
|||
|
|
this.old.scrollLeft = e.detail.scrollLeft;
|
|||
|
|
},
|
|||
|
|
RefreshScrollLeft(clientRect) {
|
|||
|
|
var left = clientRect.left;
|
|||
|
|
if (left > 0) {
|
|||
|
|
left = clientRect.right;
|
|||
|
|
}
|
|||
|
|
if (left > this.windowWidth) {
|
|||
|
|
var left1 = this.old.scrollLeft + (left - this.windowWidth + 10);
|
|||
|
|
this.scrollLeft = left1;
|
|||
|
|
} else if (left < 0) {
|
|||
|
|
this.scrollLeft = this.old.scrollLeft + (left - 20);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
|
|||
|
|
return vue.openBlock(), vue.createElementBlock("scroll-view", {
|
|||
|
|
"scroll-x": "true",
|
|||
|
|
"scroll-left": $data.scrollLeft,
|
|||
|
|
onScroll: _cache[0] || (_cache[0] = (...args) => $options.scroll && $options.scroll(...args))
|
|||
|
|
}, [
|
|||
|
|
vue.renderSlot(_ctx.$slots, "default")
|
|||
|
|
], 40, ["scroll-left"]);
|
|||
|
|
}
|
|||
|
|
const __easycom_1 = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["render", _sfc_render$6], ["__file", "/Users/yunzhi/Projects/TV/电视TV影视APP/components/unitv-scroll/unitv-scroll.vue"]]);
|
|||
|
|
const block0 = (Comp) => {
|
|||
|
|
(Comp.$renderjs || (Comp.$renderjs = [])).push("whole");
|
|||
|
|
(Comp.$renderjsModules || (Comp.$renderjsModules = {}))["whole"] = "5c9edcc4";
|
|||
|
|
};
|
|||
|
|
const _sfc_main$6 = {
|
|||
|
|
name: "unitvPage",
|
|||
|
|
props: {
|
|||
|
|
id: {
|
|||
|
|
type: String,
|
|||
|
|
required: true
|
|||
|
|
},
|
|||
|
|
prePageId: {
|
|||
|
|
type: String
|
|||
|
|
},
|
|||
|
|
show: {
|
|||
|
|
type: Boolean,
|
|||
|
|
default: false
|
|||
|
|
},
|
|||
|
|
handleEvent: {
|
|||
|
|
type: Boolean,
|
|||
|
|
default: false
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
provide() {
|
|||
|
|
return {
|
|||
|
|
pageId: this.id,
|
|||
|
|
pageState: this.pageState
|
|||
|
|
};
|
|||
|
|
},
|
|||
|
|
created() {
|
|||
|
|
if (this.show) {
|
|||
|
|
this.switchPage(this);
|
|||
|
|
}
|
|||
|
|
uni.getSystemInfo({
|
|||
|
|
success: (res) => {
|
|||
|
|
this.windowHeight = res.windowHeight;
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
},
|
|||
|
|
mounted() {
|
|||
|
|
this.pushPage(this);
|
|||
|
|
},
|
|||
|
|
computed: {
|
|||
|
|
...mapState(["currentZone", "currentPage", "allPages"]),
|
|||
|
|
current: function() {
|
|||
|
|
return this.currentPage == this;
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
data() {
|
|||
|
|
return {
|
|||
|
|
key: "",
|
|||
|
|
oldKey: "",
|
|||
|
|
windowHeight: null,
|
|||
|
|
scrollTop: 0,
|
|||
|
|
old: {
|
|||
|
|
scrollTop: 0
|
|||
|
|
},
|
|||
|
|
Zone: [],
|
|||
|
|
pageState: {
|
|||
|
|
curZoneId: "",
|
|||
|
|
handleEvent: this.handleEvent
|
|||
|
|
},
|
|||
|
|
transfromClass: {
|
|||
|
|
"position": "fixed",
|
|||
|
|
"bottom": 0,
|
|||
|
|
"top": 0,
|
|||
|
|
"left": 0,
|
|||
|
|
"right": 0,
|
|||
|
|
"display": "flex",
|
|||
|
|
"justify-content": "center",
|
|||
|
|
"align-items": "center"
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
},
|
|||
|
|
methods: {
|
|||
|
|
...mapMutations(["switchPage", "switchZone", "pushPage"]),
|
|||
|
|
showPage() {
|
|||
|
|
this.switchPage(this);
|
|||
|
|
this.switchZone(this.Zone[this.pageState.curZoneId]);
|
|||
|
|
this.Zone[this.pageState.curZoneId].refreshItem();
|
|||
|
|
return true;
|
|||
|
|
},
|
|||
|
|
pushZone(zone) {
|
|||
|
|
this.Zone[zone.id] = zone;
|
|||
|
|
},
|
|||
|
|
keyCodeClick2(obj) {
|
|||
|
|
let keyCode = obj.code;
|
|||
|
|
this.key = keyCode;
|
|||
|
|
this.oldKey = obj.oldCode;
|
|||
|
|
},
|
|||
|
|
keyCodeClick(obj) {
|
|||
|
|
let keyCode = obj.code;
|
|||
|
|
this.key = keyCode;
|
|||
|
|
this.oldKey = obj.oldCode;
|
|||
|
|
if (this.pageState.handleEvent) {
|
|||
|
|
uni.$emit("keyDown", keyCode);
|
|||
|
|
} else {
|
|||
|
|
switch (keyCode) {
|
|||
|
|
case "KeyUp":
|
|||
|
|
this.evtArrow("up");
|
|||
|
|
break;
|
|||
|
|
case "KeyDown":
|
|||
|
|
this.evtArrow("down");
|
|||
|
|
break;
|
|||
|
|
case "KeyLeft":
|
|||
|
|
this.evtArrow("left");
|
|||
|
|
break;
|
|||
|
|
case "KeyRight":
|
|||
|
|
this.evtArrow("right");
|
|||
|
|
break;
|
|||
|
|
case "KeyEnter":
|
|||
|
|
this.evtEnter();
|
|||
|
|
break;
|
|||
|
|
case "KeyBack":
|
|||
|
|
this.evtBack();
|
|||
|
|
break;
|
|||
|
|
case "KeyDel":
|
|||
|
|
this.evtDel();
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
evtArrow: function(Arrow) {
|
|||
|
|
var zone = this.currentZone;
|
|||
|
|
zone.evtArrow(Arrow);
|
|||
|
|
},
|
|||
|
|
evtEnter: function() {
|
|||
|
|
this.currentZone.evtEnter();
|
|||
|
|
},
|
|||
|
|
evtDel: function() {
|
|||
|
|
this.currentZone.evtDel();
|
|||
|
|
},
|
|||
|
|
evtBack: function() {
|
|||
|
|
this.$emit("back");
|
|||
|
|
this.key = "KeyBack";
|
|||
|
|
},
|
|||
|
|
scroll: function(e) {
|
|||
|
|
this.old.scrollTop = e.detail.scrollTop;
|
|||
|
|
},
|
|||
|
|
ChangeZone(zoneId) {
|
|||
|
|
var zone = this.Zone[zoneId];
|
|||
|
|
if (zone) {
|
|||
|
|
this.currentZone.zoneState.curZone = false;
|
|||
|
|
this.pageState.curZoneId = zoneId;
|
|||
|
|
zone.zoneState.curZone = true;
|
|||
|
|
this.switchZone(this.Zone[zoneId]);
|
|||
|
|
this.Zone[zoneId].refreshItem();
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
RefreshScrollTop(clientRect) {
|
|||
|
|
var top = clientRect.top;
|
|||
|
|
if (top > 0) {
|
|||
|
|
top = clientRect.bottom;
|
|||
|
|
}
|
|||
|
|
if (top > this.windowHeight) {
|
|||
|
|
var top1 = this.old.scrollTop + (top - this.windowHeight + 10);
|
|||
|
|
this.scrollTop = top1;
|
|||
|
|
} else if (top < 0) {
|
|||
|
|
this.scrollTop = this.old.scrollTop + (top - 20);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
watch: {
|
|||
|
|
handleEvent: function(val) {
|
|||
|
|
this.pageState.handleEvent = val;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
|
|||
|
|
return vue.openBlock(), vue.createElementBlock(
|
|||
|
|
vue.Fragment,
|
|||
|
|
null,
|
|||
|
|
[
|
|||
|
|
vue.withDirectives(vue.createElementVNode("scroll-view", {
|
|||
|
|
"scroll-y": "true",
|
|||
|
|
style: vue.normalizeStyle({ height: $data.windowHeight + "px" }),
|
|||
|
|
ref: "page",
|
|||
|
|
"scroll-top": $data.scrollTop,
|
|||
|
|
onScroll: _cache[2] || (_cache[2] = (...args) => $options.scroll && $options.scroll(...args))
|
|||
|
|
}, [
|
|||
|
|
vue.createElementVNode("view", {
|
|||
|
|
onClick: _cache[0] || (_cache[0] = (...args) => _ctx.whole.onClick && _ctx.whole.onClick(...args)),
|
|||
|
|
id: "onClick"
|
|||
|
|
}),
|
|||
|
|
vue.createElementVNode("view", {
|
|||
|
|
onClick: _cache[1] || (_cache[1] = (...args) => _ctx.whole.onClick2 && _ctx.whole.onClick2(...args)),
|
|||
|
|
id: "onClick2"
|
|||
|
|
}),
|
|||
|
|
vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
|||
|
|
], 44, ["scroll-top"]), [
|
|||
|
|
[vue.vShow, $options.current]
|
|||
|
|
]),
|
|||
|
|
vue.createCommentVNode(` <unitv-transition :duration="500" :mode-class="['fade']" :styles="transfromClass" :show="current">
|
|||
|
|
</unitv-transition> `)
|
|||
|
|
],
|
|||
|
|
2112
|
|||
|
|
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
|
|||
|
|
);
|
|||
|
|
}
|
|||
|
|
if (typeof block0 === "function")
|
|||
|
|
block0(_sfc_main$6);
|
|||
|
|
const __easycom_2 = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["render", _sfc_render$5], ["__scopeId", "data-v-273aa4af"], ["__file", "/Users/yunzhi/Projects/TV/电视TV影视APP/components/unitv-page/unitv-page.vue"]]);
|
|||
|
|
const _imports_0 = "/static/fullscreen.png";
|
|||
|
|
const _imports_1 = "/static/favicon.png";
|
|||
|
|
const _sfc_main$5 = {
|
|||
|
|
data() {
|
|||
|
|
return {
|
|||
|
|
item: [],
|
|||
|
|
status: 0,
|
|||
|
|
handEvt: false,
|
|||
|
|
currentTime: 0,
|
|||
|
|
moiveData: {},
|
|||
|
|
moiveType: "",
|
|||
|
|
moiveUrl: "",
|
|||
|
|
moiveUrlList: []
|
|||
|
|
};
|
|||
|
|
},
|
|||
|
|
onBackPress(options) {
|
|||
|
|
this.$refs.playPage.evtBack();
|
|||
|
|
return true;
|
|||
|
|
},
|
|||
|
|
onReady() {
|
|||
|
|
this.viderContext = uni.createVideoContext("player");
|
|||
|
|
},
|
|||
|
|
onLoad(e) {
|
|||
|
|
formatAppLog("log", "at pages/player/player.vue:64", e);
|
|||
|
|
this.$api.get("/platCupfox/detail/" + e.id, null).then((res) => {
|
|||
|
|
formatAppLog("log", "at pages/player/player.vue:66", res);
|
|||
|
|
if (res == void 0 || res == null || res == "") {
|
|||
|
|
uni.showToast({
|
|||
|
|
title: "视频资源数据异常,请检查接口数据",
|
|||
|
|
icon: "none",
|
|||
|
|
duration: 5e3
|
|||
|
|
});
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
this.moiveData = res;
|
|||
|
|
this.moiveType = res.type;
|
|||
|
|
this.item = res.resources;
|
|||
|
|
if (res.resources != null && res.resources.length > 0) {
|
|||
|
|
let aa = res.resources[0];
|
|||
|
|
if (aa.movieFlag == "1") {
|
|||
|
|
this.moiveUrl = aa.movieUrl;
|
|||
|
|
if (res.type == "multiple") {
|
|||
|
|
this.moiveUrlList = aa.resourceUrlList;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
},
|
|||
|
|
methods: {
|
|||
|
|
switchFullScreen() {
|
|||
|
|
this.viderContext.requestFullScreen();
|
|||
|
|
},
|
|||
|
|
websiteClick(data) {
|
|||
|
|
if (data.movieFlag == "1") {
|
|||
|
|
if (this.moiveType == "multiple") {
|
|||
|
|
this.moiveUrlList = data.resourceUrlList;
|
|||
|
|
} else {
|
|||
|
|
this.moiveUrl = data.movieUrl;
|
|||
|
|
}
|
|||
|
|
} else {
|
|||
|
|
uni.showToast({
|
|||
|
|
title: "当前站点视频还未解析,请联系系统管理员处理",
|
|||
|
|
icon: "none",
|
|||
|
|
duration: 2e3
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
websiteHover(data) {
|
|||
|
|
formatAppLog("log", "at pages/player/player.vue:112", "websiteHover");
|
|||
|
|
},
|
|||
|
|
pageBack(e) {
|
|||
|
|
formatAppLog("log", "at pages/player/player.vue:121", "按了返回");
|
|||
|
|
uni.reLaunch({
|
|||
|
|
url: "../index/index"
|
|||
|
|
});
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
|
|||
|
|
const _component_unitv_video = resolveEasycom(vue.resolveDynamicComponent("unitv-video"), __easycom_0$2);
|
|||
|
|
const _component_unitv_item = resolveEasycom(vue.resolveDynamicComponent("unitv-item"), __easycom_0$1);
|
|||
|
|
const _component_unitv_zone = resolveEasycom(vue.resolveDynamicComponent("unitv-zone"), __easycom_1$1);
|
|||
|
|
const _component_unitv_scroll = resolveEasycom(vue.resolveDynamicComponent("unitv-scroll"), __easycom_1);
|
|||
|
|
const _component_unitv_page = resolveEasycom(vue.resolveDynamicComponent("unitv-page"), __easycom_2);
|
|||
|
|
return vue.openBlock(), vue.createElementBlock("view", null, [
|
|||
|
|
vue.createVNode(_component_unitv_page, {
|
|||
|
|
id: "playPage",
|
|||
|
|
show: true,
|
|||
|
|
ref: "playPage",
|
|||
|
|
onBack: $options.pageBack
|
|||
|
|
}, {
|
|||
|
|
default: vue.withCtx(() => [
|
|||
|
|
vue.createElementVNode("view", { class: "movie-contain" }, [
|
|||
|
|
vue.createVNode(_component_unitv_video, {
|
|||
|
|
id: "player",
|
|||
|
|
class: "player",
|
|||
|
|
src: $data.moiveUrl,
|
|||
|
|
autoplay: true
|
|||
|
|
}, null, 8, ["src"]),
|
|||
|
|
vue.createElementVNode("view", { class: "movie-inter" }, [
|
|||
|
|
vue.createElementVNode(
|
|||
|
|
"view",
|
|||
|
|
{ class: "movie-title" },
|
|||
|
|
vue.toDisplayString($data.moiveData.title),
|
|||
|
|
1
|
|||
|
|
/* TEXT */
|
|||
|
|
),
|
|||
|
|
vue.createElementVNode("view", { class: "movie-info" }, [
|
|||
|
|
vue.createElementVNode(
|
|||
|
|
"text",
|
|||
|
|
null,
|
|||
|
|
"影片信息:" + vue.toDisplayString($data.moiveData.info),
|
|||
|
|
1
|
|||
|
|
/* TEXT */
|
|||
|
|
)
|
|||
|
|
]),
|
|||
|
|
vue.createElementVNode(
|
|||
|
|
"view",
|
|||
|
|
{ class: "movie-content" },
|
|||
|
|
"简介:" + vue.toDisplayString($data.moiveData.comment),
|
|||
|
|
1
|
|||
|
|
/* TEXT */
|
|||
|
|
),
|
|||
|
|
vue.createElementVNode("view", null, [
|
|||
|
|
vue.createVNode(_component_unitv_zone, {
|
|||
|
|
id: "btn-zone",
|
|||
|
|
autoFous: true,
|
|||
|
|
column: 2,
|
|||
|
|
down: "list-zone",
|
|||
|
|
item: 0,
|
|||
|
|
values: [0, 1],
|
|||
|
|
class: "btn-zone"
|
|||
|
|
}, {
|
|||
|
|
default: vue.withCtx(() => [
|
|||
|
|
vue.createVNode(_component_unitv_item, {
|
|||
|
|
item: 0,
|
|||
|
|
class: "fullscreen-btn",
|
|||
|
|
onClick: $options.switchFullScreen
|
|||
|
|
}, {
|
|||
|
|
default: vue.withCtx(() => [
|
|||
|
|
vue.createElementVNode("image", {
|
|||
|
|
mode: "aspectFit",
|
|||
|
|
src: _imports_0
|
|||
|
|
}),
|
|||
|
|
vue.createElementVNode("view", null, "全屏播放")
|
|||
|
|
]),
|
|||
|
|
_: 1
|
|||
|
|
/* STABLE */
|
|||
|
|
}, 8, ["onClick"]),
|
|||
|
|
vue.createVNode(_component_unitv_item, {
|
|||
|
|
item: 1,
|
|||
|
|
class: "favicon-btn"
|
|||
|
|
}, {
|
|||
|
|
default: vue.withCtx(() => [
|
|||
|
|
vue.createElementVNode("image", {
|
|||
|
|
mode: "aspectFit",
|
|||
|
|
src: _imports_1
|
|||
|
|
}),
|
|||
|
|
vue.createElementVNode("view", null, "收藏")
|
|||
|
|
]),
|
|||
|
|
_: 1
|
|||
|
|
/* STABLE */
|
|||
|
|
})
|
|||
|
|
]),
|
|||
|
|
_: 1
|
|||
|
|
/* STABLE */
|
|||
|
|
})
|
|||
|
|
])
|
|||
|
|
])
|
|||
|
|
]),
|
|||
|
|
vue.createVNode(_component_unitv_zone, {
|
|||
|
|
id: "list-zone",
|
|||
|
|
class: "list-zone",
|
|||
|
|
up: "btn-zone",
|
|||
|
|
down: $data.moiveType == "multiple" ? "resource-zone" : "",
|
|||
|
|
values: $data.item,
|
|||
|
|
column: 8
|
|||
|
|
}, {
|
|||
|
|
default: vue.withCtx(() => [
|
|||
|
|
(vue.openBlock(true), vue.createElementBlock(
|
|||
|
|
vue.Fragment,
|
|||
|
|
null,
|
|||
|
|
vue.renderList($data.item, (a, index) => {
|
|||
|
|
return vue.openBlock(), vue.createBlock(_component_unitv_item, {
|
|||
|
|
item: index,
|
|||
|
|
key: index,
|
|||
|
|
class: "item",
|
|||
|
|
style: vue.normalizeStyle(a.movieFlag == "1" ? "background-color: #CD7F32;" : ""),
|
|||
|
|
onClick: ($event) => $options.websiteClick(a),
|
|||
|
|
onHover: ($event) => $options.websiteHover(a)
|
|||
|
|
}, {
|
|||
|
|
default: vue.withCtx(() => [
|
|||
|
|
vue.createTextVNode(
|
|||
|
|
vue.toDisplayString(a.website),
|
|||
|
|
1
|
|||
|
|
/* TEXT */
|
|||
|
|
)
|
|||
|
|
]),
|
|||
|
|
_: 2
|
|||
|
|
/* DYNAMIC */
|
|||
|
|
}, 1032, ["item", "style", "onClick", "onHover"]);
|
|||
|
|
}),
|
|||
|
|
128
|
|||
|
|
/* KEYED_FRAGMENT */
|
|||
|
|
))
|
|||
|
|
]),
|
|||
|
|
_: 1
|
|||
|
|
/* STABLE */
|
|||
|
|
}, 8, ["down", "values"]),
|
|||
|
|
$data.moiveType == "multiple" ? (vue.openBlock(), vue.createElementBlock("view", {
|
|||
|
|
key: 0,
|
|||
|
|
class: "title"
|
|||
|
|
}, "影视剧集")) : vue.createCommentVNode("v-if", true),
|
|||
|
|
$data.moiveType == "multiple" ? (vue.openBlock(), vue.createBlock(_component_unitv_zone, {
|
|||
|
|
key: 1,
|
|||
|
|
id: "resource-zone",
|
|||
|
|
class: "resource-zone",
|
|||
|
|
up: "list-zone",
|
|||
|
|
values: $data.moiveUrlList,
|
|||
|
|
column: $data.moiveUrlList.length
|
|||
|
|
}, {
|
|||
|
|
default: vue.withCtx(() => [
|
|||
|
|
vue.createVNode(_component_unitv_scroll, null, {
|
|||
|
|
default: vue.withCtx(() => [
|
|||
|
|
(vue.openBlock(true), vue.createElementBlock(
|
|||
|
|
vue.Fragment,
|
|||
|
|
null,
|
|||
|
|
vue.renderList($data.moiveUrlList, (a, index) => {
|
|||
|
|
return vue.openBlock(), vue.createBlock(_component_unitv_item, {
|
|||
|
|
item: index,
|
|||
|
|
key: index,
|
|||
|
|
class: "item-resource"
|
|||
|
|
}, {
|
|||
|
|
default: vue.withCtx(() => [
|
|||
|
|
vue.createElementVNode(
|
|||
|
|
"view",
|
|||
|
|
{ class: "item-resource-info" },
|
|||
|
|
vue.toDisplayString(a.name),
|
|||
|
|
1
|
|||
|
|
/* TEXT */
|
|||
|
|
)
|
|||
|
|
]),
|
|||
|
|
_: 2
|
|||
|
|
/* DYNAMIC */
|
|||
|
|
}, 1032, ["item"]);
|
|||
|
|
}),
|
|||
|
|
128
|
|||
|
|
/* KEYED_FRAGMENT */
|
|||
|
|
))
|
|||
|
|
]),
|
|||
|
|
_: 1
|
|||
|
|
/* STABLE */
|
|||
|
|
})
|
|||
|
|
]),
|
|||
|
|
_: 1
|
|||
|
|
/* STABLE */
|
|||
|
|
}, 8, ["values", "column"])) : vue.createCommentVNode("v-if", true)
|
|||
|
|
]),
|
|||
|
|
_: 1
|
|||
|
|
/* STABLE */
|
|||
|
|
}, 8, ["onBack"])
|
|||
|
|
]);
|
|||
|
|
}
|
|||
|
|
const PagesPlayerPlayer = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["render", _sfc_render$4], ["__file", "/Users/yunzhi/Projects/TV/电视TV影视APP/pages/player/player.vue"]]);
|
|||
|
|
const _sfc_main$4 = {
|
|||
|
|
data() {
|
|||
|
|
return {
|
|||
|
|
item1: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
|
|||
|
|
item5: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18],
|
|||
|
|
curSwiper: 0,
|
|||
|
|
nextZone: "szone_1"
|
|||
|
|
};
|
|||
|
|
},
|
|||
|
|
computed: {},
|
|||
|
|
onLoad() {
|
|||
|
|
},
|
|||
|
|
onReady() {
|
|||
|
|
},
|
|||
|
|
methods: {
|
|||
|
|
hoverItem(e) {
|
|||
|
|
formatAppLog("log", "at pages/swiper/swiper.vue:41", "获得焦点:" + e);
|
|||
|
|
this.curSwiper = e;
|
|||
|
|
this.nextZone = "szone_" + (e + 1);
|
|||
|
|
},
|
|||
|
|
clickItem(e) {
|
|||
|
|
formatAppLog("log", "at pages/swiper/swiper.vue:46", "点击了:" + e);
|
|||
|
|
uni.showToast({
|
|||
|
|
title: "成功点击了",
|
|||
|
|
icon: "none",
|
|||
|
|
duration: 2e3
|
|||
|
|
});
|
|||
|
|
},
|
|||
|
|
loadMore() {
|
|||
|
|
uni.showToast({
|
|||
|
|
title: "到达底部",
|
|||
|
|
icon: "none",
|
|||
|
|
duration: 2e3
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|||
|
|
const _component_unitv_item = resolveEasycom(vue.resolveDynamicComponent("unitv-item"), __easycom_0$1);
|
|||
|
|
const _component_unitv_scroll = resolveEasycom(vue.resolveDynamicComponent("unitv-scroll"), __easycom_1);
|
|||
|
|
const _component_unitv_zone = resolveEasycom(vue.resolveDynamicComponent("unitv-zone"), __easycom_1$1);
|
|||
|
|
const _component_unitv_page = resolveEasycom(vue.resolveDynamicComponent("unitv-page"), __easycom_2);
|
|||
|
|
return vue.openBlock(), vue.createElementBlock("view", { class: "page content" }, [
|
|||
|
|
vue.createVNode(
|
|||
|
|
_component_unitv_page,
|
|||
|
|
{
|
|||
|
|
id: "swiperPage",
|
|||
|
|
ref: "swiperPage"
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
default: vue.withCtx(() => [
|
|||
|
|
vue.createElementVNode("view", null, [
|
|||
|
|
vue.createVNode(_component_unitv_zone, {
|
|||
|
|
id: "zone1",
|
|||
|
|
class: "zone1",
|
|||
|
|
autoFous: true,
|
|||
|
|
down: $data.nextZone,
|
|||
|
|
item: 0,
|
|||
|
|
values: $data.item1,
|
|||
|
|
column: $data.item1.length
|
|||
|
|
}, {
|
|||
|
|
default: vue.withCtx(() => [
|
|||
|
|
vue.createVNode(_component_unitv_scroll, null, {
|
|||
|
|
default: vue.withCtx(() => [
|
|||
|
|
(vue.openBlock(true), vue.createElementBlock(
|
|||
|
|
vue.Fragment,
|
|||
|
|
null,
|
|||
|
|
vue.renderList($data.item1, (a, index) => {
|
|||
|
|
return vue.openBlock(), vue.createBlock(_component_unitv_item, {
|
|||
|
|
item: index,
|
|||
|
|
key: index,
|
|||
|
|
class: "item",
|
|||
|
|
onHover: $options.hoverItem
|
|||
|
|
}, {
|
|||
|
|
default: vue.withCtx(() => [
|
|||
|
|
vue.createTextVNode(
|
|||
|
|
vue.toDisplayString(a),
|
|||
|
|
1
|
|||
|
|
/* TEXT */
|
|||
|
|
)
|
|||
|
|
]),
|
|||
|
|
_: 2
|
|||
|
|
/* DYNAMIC */
|
|||
|
|
}, 1032, ["item", "onHover"]);
|
|||
|
|
}),
|
|||
|
|
128
|
|||
|
|
/* KEYED_FRAGMENT */
|
|||
|
|
))
|
|||
|
|
]),
|
|||
|
|
_: 1
|
|||
|
|
/* STABLE */
|
|||
|
|
})
|
|||
|
|
]),
|
|||
|
|
_: 1
|
|||
|
|
/* STABLE */
|
|||
|
|
}, 8, ["down", "values", "column"])
|
|||
|
|
]),
|
|||
|
|
vue.createElementVNode("swiper", {
|
|||
|
|
class: "swiper",
|
|||
|
|
current: $data.curSwiper
|
|||
|
|
}, [
|
|||
|
|
(vue.openBlock(true), vue.createElementBlock(
|
|||
|
|
vue.Fragment,
|
|||
|
|
null,
|
|||
|
|
vue.renderList($data.item1, (s, index) => {
|
|||
|
|
return vue.openBlock(), vue.createElementBlock("swiper-item", {
|
|||
|
|
"data-zone": "szone_" + s,
|
|||
|
|
key: "s_" + index
|
|||
|
|
}, [
|
|||
|
|
vue.createVNode(_component_unitv_zone, {
|
|||
|
|
id: "szone_" + s,
|
|||
|
|
class: "zone5",
|
|||
|
|
up: "zone1",
|
|||
|
|
values: $data.item5,
|
|||
|
|
column: 6,
|
|||
|
|
onScrolltolower: $options.loadMore
|
|||
|
|
}, {
|
|||
|
|
default: vue.withCtx(() => [
|
|||
|
|
(vue.openBlock(true), vue.createElementBlock(
|
|||
|
|
vue.Fragment,
|
|||
|
|
null,
|
|||
|
|
vue.renderList($data.item5, (a, index2) => {
|
|||
|
|
return vue.openBlock(), vue.createBlock(_component_unitv_item, {
|
|||
|
|
item: index2,
|
|||
|
|
key: index2,
|
|||
|
|
class: "item"
|
|||
|
|
}, {
|
|||
|
|
default: vue.withCtx(() => [
|
|||
|
|
vue.createTextVNode(
|
|||
|
|
vue.toDisplayString(s) + "-" + vue.toDisplayString(a),
|
|||
|
|
1
|
|||
|
|
/* TEXT */
|
|||
|
|
)
|
|||
|
|
]),
|
|||
|
|
_: 2
|
|||
|
|
/* DYNAMIC */
|
|||
|
|
}, 1032, ["item"]);
|
|||
|
|
}),
|
|||
|
|
128
|
|||
|
|
/* KEYED_FRAGMENT */
|
|||
|
|
))
|
|||
|
|
]),
|
|||
|
|
_: 2
|
|||
|
|
/* DYNAMIC */
|
|||
|
|
}, 1032, ["id", "values", "onScrolltolower"])
|
|||
|
|
], 8, ["data-zone"]);
|
|||
|
|
}),
|
|||
|
|
128
|
|||
|
|
/* KEYED_FRAGMENT */
|
|||
|
|
))
|
|||
|
|
], 8, ["current"])
|
|||
|
|
]),
|
|||
|
|
_: 1
|
|||
|
|
/* STABLE */
|
|||
|
|
},
|
|||
|
|
512
|
|||
|
|
/* NEED_PATCH */
|
|||
|
|
)
|
|||
|
|
]);
|
|||
|
|
}
|
|||
|
|
const PagesSwiperSwiper = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["render", _sfc_render$3], ["__file", "/Users/yunzhi/Projects/TV/电视TV影视APP/pages/swiper/swiper.vue"]]);
|
|||
|
|
const _sfc_main$3 = {
|
|||
|
|
name: "uniTransition",
|
|||
|
|
props: {
|
|||
|
|
show: {
|
|||
|
|
type: Boolean,
|
|||
|
|
default: false
|
|||
|
|
},
|
|||
|
|
modeClass: {
|
|||
|
|
type: Array,
|
|||
|
|
default() {
|
|||
|
|
return [];
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
duration: {
|
|||
|
|
type: Number,
|
|||
|
|
default: 300
|
|||
|
|
},
|
|||
|
|
styles: {
|
|||
|
|
type: Object,
|
|||
|
|
default() {
|
|||
|
|
return {};
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
data() {
|
|||
|
|
return {
|
|||
|
|
isShow: false,
|
|||
|
|
transform: "",
|
|||
|
|
ani: {
|
|||
|
|
in: "",
|
|||
|
|
active: ""
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
},
|
|||
|
|
watch: {
|
|||
|
|
show: {
|
|||
|
|
handler(newVal) {
|
|||
|
|
if (newVal) {
|
|||
|
|
this.open();
|
|||
|
|
} else {
|
|||
|
|
this.close();
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
immediate: true
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
computed: {
|
|||
|
|
stylesObject() {
|
|||
|
|
let styles = {
|
|||
|
|
...this.styles,
|
|||
|
|
"transition-duration": this.duration / 1e3 + "s"
|
|||
|
|
};
|
|||
|
|
let transfrom = "";
|
|||
|
|
for (let i in styles) {
|
|||
|
|
let line = this.toLine(i);
|
|||
|
|
transfrom += line + ":" + styles[i] + ";";
|
|||
|
|
}
|
|||
|
|
return transfrom;
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
created() {
|
|||
|
|
},
|
|||
|
|
methods: {
|
|||
|
|
change() {
|
|||
|
|
this.$emit("click", {
|
|||
|
|
detail: this.isShow
|
|||
|
|
});
|
|||
|
|
},
|
|||
|
|
open() {
|
|||
|
|
clearTimeout(this.timer);
|
|||
|
|
this.isShow = true;
|
|||
|
|
this.transform = "";
|
|||
|
|
this.ani.in = "";
|
|||
|
|
for (let i in this.getTranfrom(false)) {
|
|||
|
|
if (i === "opacity") {
|
|||
|
|
this.ani.in = "fade-in";
|
|||
|
|
} else {
|
|||
|
|
this.transform += `${this.getTranfrom(false)[i]} `;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
this.$nextTick(() => {
|
|||
|
|
setTimeout(() => {
|
|||
|
|
this._animation(true);
|
|||
|
|
}, 50);
|
|||
|
|
});
|
|||
|
|
},
|
|||
|
|
close(type) {
|
|||
|
|
clearTimeout(this.timer);
|
|||
|
|
this._animation(false);
|
|||
|
|
},
|
|||
|
|
_animation(type) {
|
|||
|
|
let styles = this.getTranfrom(type);
|
|||
|
|
this.transform = "";
|
|||
|
|
for (let i in styles) {
|
|||
|
|
if (i === "opacity") {
|
|||
|
|
this.ani.in = `fade-${type ? "out" : "in"}`;
|
|||
|
|
} else {
|
|||
|
|
this.transform += `${styles[i]} `;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
this.timer = setTimeout(() => {
|
|||
|
|
if (!type) {
|
|||
|
|
this.isShow = false;
|
|||
|
|
}
|
|||
|
|
this.$emit("change", {
|
|||
|
|
detail: this.isShow
|
|||
|
|
});
|
|||
|
|
}, this.duration);
|
|||
|
|
},
|
|||
|
|
getTranfrom(type) {
|
|||
|
|
let styles = {
|
|||
|
|
transform: ""
|
|||
|
|
};
|
|||
|
|
this.modeClass.forEach((mode) => {
|
|||
|
|
switch (mode) {
|
|||
|
|
case "fade":
|
|||
|
|
styles.opacity = type ? 1 : 0;
|
|||
|
|
break;
|
|||
|
|
case "slide-top":
|
|||
|
|
styles.transform += `translateY(${type ? "0" : "-100%"}) `;
|
|||
|
|
break;
|
|||
|
|
case "slide-right":
|
|||
|
|
styles.transform += `translateX(${type ? "0" : "100%"}) `;
|
|||
|
|
break;
|
|||
|
|
case "slide-bottom":
|
|||
|
|
styles.transform += `translateY(${type ? "0" : "100%"}) `;
|
|||
|
|
break;
|
|||
|
|
case "slide-left":
|
|||
|
|
styles.transform += `translateX(${type ? "0" : "-100%"}) `;
|
|||
|
|
break;
|
|||
|
|
case "zoom-in":
|
|||
|
|
styles.transform += `scale(${type ? 1 : 0.8}) `;
|
|||
|
|
break;
|
|||
|
|
case "zoom-out":
|
|||
|
|
styles.transform += `scale(${type ? 1 : 1.2}) `;
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
return styles;
|
|||
|
|
},
|
|||
|
|
_modeClassArr(type) {
|
|||
|
|
let mode = this.modeClass;
|
|||
|
|
if (typeof mode !== "string") {
|
|||
|
|
let modestr = "";
|
|||
|
|
mode.forEach((item) => {
|
|||
|
|
modestr += item + "-" + type + ",";
|
|||
|
|
});
|
|||
|
|
return modestr.substr(0, modestr.length - 1);
|
|||
|
|
} else {
|
|||
|
|
return mode + "-" + type;
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
// getEl(el) {
|
|||
|
|
// __f__('log','at components/unitv-transition/unitv-transition.vue:208',el || el.ref || null);
|
|||
|
|
// return el || el.ref || null
|
|||
|
|
// },
|
|||
|
|
toLine(name) {
|
|||
|
|
return name.replace(/([A-Z])/g, "-$1").toLowerCase();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|||
|
|
return $data.isShow ? (vue.openBlock(), vue.createElementBlock(
|
|||
|
|
"view",
|
|||
|
|
{
|
|||
|
|
key: 0,
|
|||
|
|
ref: "ani",
|
|||
|
|
class: vue.normalizeClass(["uni-transition", [$data.ani.in]]),
|
|||
|
|
style: vue.normalizeStyle("transform:" + $data.transform + ";" + $options.stylesObject),
|
|||
|
|
onClick: _cache[0] || (_cache[0] = (...args) => $options.change && $options.change(...args))
|
|||
|
|
},
|
|||
|
|
[
|
|||
|
|
vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
|||
|
|
],
|
|||
|
|
6
|
|||
|
|
/* CLASS, STYLE */
|
|||
|
|
)) : vue.createCommentVNode("v-if", true);
|
|||
|
|
}
|
|||
|
|
const __easycom_0 = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render$2], ["__scopeId", "data-v-9a8be1b4"], ["__file", "/Users/yunzhi/Projects/TV/电视TV影视APP/components/unitv-transition/unitv-transition.vue"]]);
|
|||
|
|
const _sfc_main$2 = {
|
|||
|
|
components: {},
|
|||
|
|
data() {
|
|||
|
|
return {
|
|||
|
|
show: false,
|
|||
|
|
transShow: false,
|
|||
|
|
modeClass: ["fade"],
|
|||
|
|
maskClass: {
|
|||
|
|
"position": "fixed",
|
|||
|
|
"bottom": 0,
|
|||
|
|
"top": 0,
|
|||
|
|
"left": 0,
|
|||
|
|
"right": 0,
|
|||
|
|
"background-color": "rgba(0, 0, 0, 0.4)"
|
|||
|
|
},
|
|||
|
|
transfromClass: {
|
|||
|
|
"position": "fixed",
|
|||
|
|
"bottom": 0,
|
|||
|
|
"top": 0,
|
|||
|
|
"left": 0,
|
|||
|
|
"right": 0,
|
|||
|
|
"display": "flex",
|
|||
|
|
"justify-content": "center",
|
|||
|
|
"align-items": "center"
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
},
|
|||
|
|
onLoad() {
|
|||
|
|
},
|
|||
|
|
methods: {
|
|||
|
|
mask() {
|
|||
|
|
this.show = true;
|
|||
|
|
},
|
|||
|
|
open(mode) {
|
|||
|
|
this.modeClass = mode;
|
|||
|
|
this.transShow = !this.transShow;
|
|||
|
|
},
|
|||
|
|
onTap() {
|
|||
|
|
this.transShow = this.show = false;
|
|||
|
|
},
|
|||
|
|
change(e) {
|
|||
|
|
formatAppLog("log", "at pages/transition/transition.vue:73", e.detail);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|||
|
|
const _component_unitv_transition = resolveEasycom(vue.resolveDynamicComponent("unitv-transition"), __easycom_0);
|
|||
|
|
return vue.openBlock(), vue.createElementBlock("view", null, [
|
|||
|
|
vue.createElementVNode("text", { class: "example-info" }, "过渡动画,通常用于元素的过渡效果,例如淡隐淡出效果,遮罩层的效果、放大缩小的效果等"),
|
|||
|
|
vue.createElementVNode("view", { class: "example-body" }, [
|
|||
|
|
vue.createElementVNode("button", {
|
|||
|
|
class: "transition-button",
|
|||
|
|
type: "primary",
|
|||
|
|
onClick: _cache[0] || (_cache[0] = ($event) => $options.open(["fade"]))
|
|||
|
|
}, "fade"),
|
|||
|
|
vue.createElementVNode("button", {
|
|||
|
|
class: "transition-button",
|
|||
|
|
type: "primary",
|
|||
|
|
onClick: _cache[1] || (_cache[1] = ($event) => $options.open(["slide-top"]))
|
|||
|
|
}, "slide-top"),
|
|||
|
|
vue.createElementVNode("button", {
|
|||
|
|
class: "transition-button",
|
|||
|
|
type: "primary",
|
|||
|
|
onClick: _cache[2] || (_cache[2] = ($event) => $options.open(["slide-left"]))
|
|||
|
|
}, "slide-left"),
|
|||
|
|
vue.createElementVNode("button", {
|
|||
|
|
class: "transition-button",
|
|||
|
|
type: "primary",
|
|||
|
|
onClick: _cache[3] || (_cache[3] = ($event) => $options.open(["slide-right"]))
|
|||
|
|
}, "slide-right"),
|
|||
|
|
vue.createElementVNode("button", {
|
|||
|
|
class: "transition-button",
|
|||
|
|
type: "primary",
|
|||
|
|
onClick: _cache[4] || (_cache[4] = ($event) => $options.open(["slide-bottom"]))
|
|||
|
|
}, "slide-bottom"),
|
|||
|
|
vue.createElementVNode("button", {
|
|||
|
|
class: "transition-button",
|
|||
|
|
type: "primary",
|
|||
|
|
onClick: _cache[5] || (_cache[5] = ($event) => $options.open(["zoom-in", "fade"]))
|
|||
|
|
}, "zoom-in"),
|
|||
|
|
vue.createElementVNode("button", {
|
|||
|
|
class: "transition-button",
|
|||
|
|
type: "primary",
|
|||
|
|
onClick: _cache[6] || (_cache[6] = ($event) => $options.open(["zoom-out", "fade"]))
|
|||
|
|
}, "zoom-out")
|
|||
|
|
]),
|
|||
|
|
vue.createElementVNode("view", { class: "example-body" }, [
|
|||
|
|
vue.createElementVNode("button", {
|
|||
|
|
class: "transition-button",
|
|||
|
|
type: "primary",
|
|||
|
|
onClick: _cache[7] || (_cache[7] = (...args) => $options.mask && $options.mask(...args))
|
|||
|
|
}, "透明遮罩层"),
|
|||
|
|
vue.createElementVNode("button", {
|
|||
|
|
class: "transition-button",
|
|||
|
|
type: "primary",
|
|||
|
|
onClick: _cache[8] || (_cache[8] = ($event) => $options.open(["fade", "zoom-out", "slide-top"]))
|
|||
|
|
}, "组合动画示例一"),
|
|||
|
|
vue.createElementVNode("button", {
|
|||
|
|
class: "transition-button",
|
|||
|
|
type: "primary",
|
|||
|
|
onClick: _cache[9] || (_cache[9] = ($event) => $options.open(["zoom-in", "slide-bottom", "fade"]))
|
|||
|
|
}, "组合动画示例二"),
|
|||
|
|
vue.createElementVNode("button", {
|
|||
|
|
class: "transition-button",
|
|||
|
|
type: "primary",
|
|||
|
|
onClick: _cache[10] || (_cache[10] = ($event) => $options.open(["slide-left", "slide-top", "fade"]))
|
|||
|
|
}, "组合动画示例三")
|
|||
|
|
]),
|
|||
|
|
vue.createCommentVNode(" 遮罩 "),
|
|||
|
|
vue.createVNode(_component_unitv_transition, {
|
|||
|
|
"mode-class": ["fade"],
|
|||
|
|
styles: $data.maskClass,
|
|||
|
|
show: $data.show,
|
|||
|
|
onClick: $options.onTap
|
|||
|
|
}, null, 8, ["styles", "show", "onClick"]),
|
|||
|
|
vue.createCommentVNode(" 过渡 "),
|
|||
|
|
vue.createVNode(_component_unitv_transition, {
|
|||
|
|
duration: 500,
|
|||
|
|
"mode-class": $data.modeClass,
|
|||
|
|
styles: $data.transfromClass,
|
|||
|
|
show: $data.transShow,
|
|||
|
|
onClick: $options.onTap,
|
|||
|
|
onChange: $options.change
|
|||
|
|
}, {
|
|||
|
|
default: vue.withCtx(() => [
|
|||
|
|
vue.createElementVNode("text", { class: "box" }, "Test")
|
|||
|
|
]),
|
|||
|
|
_: 1
|
|||
|
|
/* STABLE */
|
|||
|
|
}, 8, ["mode-class", "styles", "show", "onClick", "onChange"])
|
|||
|
|
]);
|
|||
|
|
}
|
|||
|
|
const PagesTransitionTransition = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$1], ["__file", "/Users/yunzhi/Projects/TV/电视TV影视APP/pages/transition/transition.vue"]]);
|
|||
|
|
const _sfc_main$1 = {
|
|||
|
|
data() {
|
|||
|
|
return {
|
|||
|
|
searchValue: "",
|
|||
|
|
item1: [1],
|
|||
|
|
item3: [],
|
|||
|
|
item3Length: 0
|
|||
|
|
};
|
|||
|
|
},
|
|||
|
|
onBackPress(options) {
|
|||
|
|
this.$refs.searchPage.evtBack();
|
|||
|
|
return true;
|
|||
|
|
},
|
|||
|
|
methods: {
|
|||
|
|
pageBack(e) {
|
|||
|
|
formatAppLog("log", "at pages/search/search.vue:35", "按了返回");
|
|||
|
|
uni.reLaunch({
|
|||
|
|
url: "../index/index"
|
|||
|
|
});
|
|||
|
|
return true;
|
|||
|
|
},
|
|||
|
|
searchMovie(e) {
|
|||
|
|
if (this.searchValue == "请输入影视名称" || this.searchValue == void 0 || this.searchValue == "" || this.searchValue == " " || this.searchValue == " ") {
|
|||
|
|
uni.showToast({
|
|||
|
|
title: "请输入影视名称后,再检索电影",
|
|||
|
|
icon: "none",
|
|||
|
|
duration: 2e3
|
|||
|
|
});
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
this.$api.post("/platCupfox/searchMovie?searchValue=" + this.searchValue, null).then((res) => {
|
|||
|
|
formatAppLog("log", "at pages/search/search.vue:57", res);
|
|||
|
|
this.item3Length = 1;
|
|||
|
|
this.item3 = [res];
|
|||
|
|
});
|
|||
|
|
},
|
|||
|
|
delItem(zoneSource, index) {
|
|||
|
|
if (zoneSource == "zone1" && index == 1) {
|
|||
|
|
if (this.searchValue != null && this.searchValue != void 0 && this.searchValue.length > 0) {
|
|||
|
|
this.searchValue = this.searchValue.substr(0, this.searchValue.length - 1);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
clickPlayer(data) {
|
|||
|
|
if (data.movieFlag == "1") {
|
|||
|
|
uni.navigateTo({
|
|||
|
|
url: "../player/player?id=" + data.id
|
|||
|
|
});
|
|||
|
|
} else {
|
|||
|
|
uni.showToast({
|
|||
|
|
title: "当前影视未解析到视频资源,无法播放",
|
|||
|
|
icon: "none",
|
|||
|
|
duration: 2e3
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|||
|
|
const _component_unitv_item = resolveEasycom(vue.resolveDynamicComponent("unitv-item"), __easycom_0$1);
|
|||
|
|
const _component_unitv_zone = resolveEasycom(vue.resolveDynamicComponent("unitv-zone"), __easycom_1$1);
|
|||
|
|
const _component_unitv_page = resolveEasycom(vue.resolveDynamicComponent("unitv-page"), __easycom_2);
|
|||
|
|
return vue.openBlock(), vue.createElementBlock("view", null, [
|
|||
|
|
vue.createVNode(_component_unitv_page, {
|
|||
|
|
id: "searchPage",
|
|||
|
|
show: true,
|
|||
|
|
ref: "searchPage",
|
|||
|
|
onBack: $options.pageBack
|
|||
|
|
}, {
|
|||
|
|
default: vue.withCtx(() => [
|
|||
|
|
vue.createVNode(_component_unitv_zone, {
|
|||
|
|
id: "zone1",
|
|||
|
|
class: "zone1",
|
|||
|
|
autoFous: true,
|
|||
|
|
down: "zone3",
|
|||
|
|
item: 0,
|
|||
|
|
values: $data.item1,
|
|||
|
|
column: $data.item1.length
|
|||
|
|
}, {
|
|||
|
|
default: vue.withCtx(() => [
|
|||
|
|
(vue.openBlock(true), vue.createElementBlock(
|
|||
|
|
vue.Fragment,
|
|||
|
|
null,
|
|||
|
|
vue.renderList($data.item1, (a, index) => {
|
|||
|
|
return vue.openBlock(), vue.createBlock(_component_unitv_item, {
|
|||
|
|
item: index,
|
|||
|
|
key: index,
|
|||
|
|
class: "item"
|
|||
|
|
}, {
|
|||
|
|
default: vue.withCtx(() => [
|
|||
|
|
vue.withDirectives(vue.createElementVNode(
|
|||
|
|
"input",
|
|||
|
|
{
|
|||
|
|
type: "text",
|
|||
|
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $data.searchValue = $event),
|
|||
|
|
"confirm-type": "search",
|
|||
|
|
onConfirm: _cache[1] || (_cache[1] = (...args) => $options.searchMovie && $options.searchMovie(...args)),
|
|||
|
|
placeholder: "请输入影视名称搜索"
|
|||
|
|
},
|
|||
|
|
null,
|
|||
|
|
544
|
|||
|
|
/* NEED_HYDRATION, NEED_PATCH */
|
|||
|
|
), [
|
|||
|
|
[vue.vModelText, $data.searchValue]
|
|||
|
|
])
|
|||
|
|
]),
|
|||
|
|
_: 2
|
|||
|
|
/* DYNAMIC */
|
|||
|
|
}, 1032, ["item"]);
|
|||
|
|
}),
|
|||
|
|
128
|
|||
|
|
/* KEYED_FRAGMENT */
|
|||
|
|
))
|
|||
|
|
]),
|
|||
|
|
_: 1
|
|||
|
|
/* STABLE */
|
|||
|
|
}, 8, ["values", "column"]),
|
|||
|
|
vue.createVNode(_component_unitv_zone, {
|
|||
|
|
id: "zone3",
|
|||
|
|
class: "zone3",
|
|||
|
|
up: "zone1",
|
|||
|
|
values: $data.item3,
|
|||
|
|
column: $data.item3Length
|
|||
|
|
}, {
|
|||
|
|
default: vue.withCtx(() => [
|
|||
|
|
(vue.openBlock(true), vue.createElementBlock(
|
|||
|
|
vue.Fragment,
|
|||
|
|
null,
|
|||
|
|
vue.renderList($data.item3, (a, index) => {
|
|||
|
|
return vue.openBlock(), vue.createBlock(_component_unitv_item, {
|
|||
|
|
item: index,
|
|||
|
|
key: index,
|
|||
|
|
class: "item",
|
|||
|
|
onClick: ($event) => $options.clickPlayer(a)
|
|||
|
|
}, {
|
|||
|
|
default: vue.withCtx(() => [
|
|||
|
|
vue.createElementVNode("image", {
|
|||
|
|
src: a.cover,
|
|||
|
|
"lazy-load": true,
|
|||
|
|
mode: "aspectFit"
|
|||
|
|
}, null, 8, ["src"])
|
|||
|
|
]),
|
|||
|
|
_: 2
|
|||
|
|
/* DYNAMIC */
|
|||
|
|
}, 1032, ["item", "onClick"]);
|
|||
|
|
}),
|
|||
|
|
128
|
|||
|
|
/* KEYED_FRAGMENT */
|
|||
|
|
))
|
|||
|
|
]),
|
|||
|
|
_: 1
|
|||
|
|
/* STABLE */
|
|||
|
|
}, 8, ["values", "column"])
|
|||
|
|
]),
|
|||
|
|
_: 1
|
|||
|
|
/* STABLE */
|
|||
|
|
}, 8, ["onBack"])
|
|||
|
|
]);
|
|||
|
|
}
|
|||
|
|
const PagesSearchSearch = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render], ["__scopeId", "data-v-c10c040c"], ["__file", "/Users/yunzhi/Projects/TV/电视TV影视APP/pages/search/search.vue"]]);
|
|||
|
|
__definePage("pages/index/index", PagesIndexIndex);
|
|||
|
|
__definePage("uni_modules/rt-uni-update/components/rt-uni-update/rt-uni-update", UniModulesRtUniUpdateComponentsRtUniUpdateRtUniUpdate);
|
|||
|
|
__definePage("pages/player/player", PagesPlayerPlayer);
|
|||
|
|
__definePage("pages/swiper/swiper", PagesSwiperSwiper);
|
|||
|
|
__definePage("pages/transition/transition", PagesTransitionTransition);
|
|||
|
|
__definePage("pages/search/search", PagesSearchSearch);
|
|||
|
|
const _sfc_main = {
|
|||
|
|
onLaunch: function() {
|
|||
|
|
},
|
|||
|
|
onShow: function() {
|
|||
|
|
formatAppLog("log", "at App.vue:7", "App Show");
|
|||
|
|
},
|
|||
|
|
onHide: function() {
|
|||
|
|
},
|
|||
|
|
methods: {}
|
|||
|
|
};
|
|||
|
|
const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "/Users/yunzhi/Projects/TV/电视TV影视APP/App.vue"]]);
|
|||
|
|
const httpRequest = {
|
|||
|
|
post: function(url, data, loading = true) {
|
|||
|
|
return new Promise((succ, error) => {
|
|||
|
|
this.ajax({
|
|||
|
|
url,
|
|||
|
|
method: "post",
|
|||
|
|
data,
|
|||
|
|
loading,
|
|||
|
|
success: function(e) {
|
|||
|
|
succ.call(this, e);
|
|||
|
|
},
|
|||
|
|
fail: function(e) {
|
|||
|
|
error ? error.call(this, e) : "";
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
});
|
|||
|
|
},
|
|||
|
|
get: function(url, data, loading = true) {
|
|||
|
|
return new Promise((succ, error) => {
|
|||
|
|
this.ajax({
|
|||
|
|
url,
|
|||
|
|
method: "GET",
|
|||
|
|
data,
|
|||
|
|
loading,
|
|||
|
|
success: function(e) {
|
|||
|
|
succ.call(this, e);
|
|||
|
|
},
|
|||
|
|
fail: function(e) {
|
|||
|
|
error ? error.call(this, e) : "";
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
});
|
|||
|
|
},
|
|||
|
|
ajax: function({ url, method, data, loading, success: success2, fail, complete }) {
|
|||
|
|
let baseUrl = "http://rap2api.taobao.org/app/mock/318020/api/platform";
|
|||
|
|
let _this = this;
|
|||
|
|
if (loading) {
|
|||
|
|
uni.showLoading({ mask: true, title: "加载中" });
|
|||
|
|
}
|
|||
|
|
uni.request({
|
|||
|
|
url: baseUrl + url,
|
|||
|
|
data,
|
|||
|
|
method,
|
|||
|
|
header: {
|
|||
|
|
"Accept": "application/json"
|
|||
|
|
},
|
|||
|
|
success: function(e) {
|
|||
|
|
if (e != null && e.statusCode != 200) {
|
|||
|
|
_this.errorStatusCode(e);
|
|||
|
|
} else if (e.data.success) {
|
|||
|
|
formatAppLog("log", "at api/httpRequest.js:48", e.data.data);
|
|||
|
|
success2(e.data.data);
|
|||
|
|
} else if (e.data.msg) {
|
|||
|
|
setTimeout(
|
|||
|
|
function(message) {
|
|||
|
|
formatAppLog("log", "at api/httpRequest.js:54", message);
|
|||
|
|
uni.showToast({ icon: "none", title: message });
|
|||
|
|
},
|
|||
|
|
100,
|
|||
|
|
e.data.msg
|
|||
|
|
);
|
|||
|
|
fail(e);
|
|||
|
|
} else {
|
|||
|
|
success2(e.data);
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
fail: function(e) {
|
|||
|
|
fail(e);
|
|||
|
|
},
|
|||
|
|
complete: function(e) {
|
|||
|
|
uni.hideLoading();
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
},
|
|||
|
|
errorStatusCode: function(e) {
|
|||
|
|
formatAppLog("log", "at api/httpRequest.js:75", e);
|
|||
|
|
uni.showModal({
|
|||
|
|
content: e.data.msg || e.data.errMsg || "系统未知异常",
|
|||
|
|
showCancel: false
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
const store = createStore({
|
|||
|
|
state: {
|
|||
|
|
currentPage: null,
|
|||
|
|
currentZone: null,
|
|||
|
|
allPages: []
|
|||
|
|
},
|
|||
|
|
mutations: {
|
|||
|
|
pushPage(state, page) {
|
|||
|
|
state.allPages[page.id] = page;
|
|||
|
|
},
|
|||
|
|
switchZone(state, zone) {
|
|||
|
|
state.currentZone = zone;
|
|||
|
|
},
|
|||
|
|
switchPage(state, page) {
|
|||
|
|
state.currentPage = page;
|
|||
|
|
},
|
|||
|
|
showPage(state, pageId) {
|
|||
|
|
var page = state.allPages[pageId];
|
|||
|
|
page.showPage();
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
actions: {}
|
|||
|
|
});
|
|||
|
|
function createApp() {
|
|||
|
|
const app = vue.createVueApp(App);
|
|||
|
|
app.config.globalProperties.$api = httpRequest;
|
|||
|
|
app.use(store);
|
|||
|
|
return {
|
|||
|
|
app
|
|||
|
|
};
|
|||
|
|
}
|
|||
|
|
const { app: __app__, Vuex: __Vuex__, Pinia: __Pinia__ } = createApp();
|
|||
|
|
uni.Vuex = __Vuex__;
|
|||
|
|
uni.Pinia = __Pinia__;
|
|||
|
|
__app__.provide("__globalStyles", __uniConfig.styles);
|
|||
|
|
__app__._component.mpType = "app";
|
|||
|
|
__app__._component.render = () => {
|
|||
|
|
};
|
|||
|
|
__app__.mount("#app");
|
|||
|
|
})(Vue);
|