jiuyiUniapp/jiuyi2/unpackage/dist/dev/.nvue/shareFirend.js

6667 lines
186 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

var __defProp = Object.defineProperty;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField = (obj, key, value) => {
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
return value;
};
import { r as requireNativePlugin, f as formatAppLog, a as resolveEasycom, o as onLoad } from "./uni-app.es.js";
import { openBlock, createElementBlock, normalizeStyle, toDisplayString, normalizeClass, renderSlot, createCommentVNode, resolveDynamicComponent, createElementVNode, createBlock, createVNode, withCtx, ref, watch, getCurrentInstance, computed, Fragment, withModifiers, onMounted, reactive, resolveComponent, nextTick, onBeforeUnmount, renderList } from "vue";
import { _ as _export_sfc } from "./_plugin-vue_export-helper.js";
import { createStore } from "vuex";
const fontData = [
{
"font_class": "arrow-down",
"unicode": ""
},
{
"font_class": "arrow-left",
"unicode": ""
},
{
"font_class": "arrow-right",
"unicode": ""
},
{
"font_class": "arrow-up",
"unicode": ""
},
{
"font_class": "auth",
"unicode": ""
},
{
"font_class": "auth-filled",
"unicode": ""
},
{
"font_class": "back",
"unicode": ""
},
{
"font_class": "bars",
"unicode": ""
},
{
"font_class": "calendar",
"unicode": ""
},
{
"font_class": "calendar-filled",
"unicode": ""
},
{
"font_class": "camera",
"unicode": ""
},
{
"font_class": "camera-filled",
"unicode": ""
},
{
"font_class": "cart",
"unicode": ""
},
{
"font_class": "cart-filled",
"unicode": ""
},
{
"font_class": "chat",
"unicode": ""
},
{
"font_class": "chat-filled",
"unicode": ""
},
{
"font_class": "chatboxes",
"unicode": ""
},
{
"font_class": "chatboxes-filled",
"unicode": ""
},
{
"font_class": "chatbubble",
"unicode": ""
},
{
"font_class": "chatbubble-filled",
"unicode": ""
},
{
"font_class": "checkbox",
"unicode": ""
},
{
"font_class": "checkbox-filled",
"unicode": ""
},
{
"font_class": "checkmarkempty",
"unicode": ""
},
{
"font_class": "circle",
"unicode": ""
},
{
"font_class": "circle-filled",
"unicode": ""
},
{
"font_class": "clear",
"unicode": ""
},
{
"font_class": "close",
"unicode": ""
},
{
"font_class": "closeempty",
"unicode": ""
},
{
"font_class": "cloud-download",
"unicode": ""
},
{
"font_class": "cloud-download-filled",
"unicode": ""
},
{
"font_class": "cloud-upload",
"unicode": ""
},
{
"font_class": "cloud-upload-filled",
"unicode": ""
},
{
"font_class": "color",
"unicode": ""
},
{
"font_class": "color-filled",
"unicode": ""
},
{
"font_class": "compose",
"unicode": ""
},
{
"font_class": "contact",
"unicode": ""
},
{
"font_class": "contact-filled",
"unicode": ""
},
{
"font_class": "down",
"unicode": ""
},
{
"font_class": "bottom",
"unicode": ""
},
{
"font_class": "download",
"unicode": ""
},
{
"font_class": "download-filled",
"unicode": ""
},
{
"font_class": "email",
"unicode": ""
},
{
"font_class": "email-filled",
"unicode": ""
},
{
"font_class": "eye",
"unicode": ""
},
{
"font_class": "eye-filled",
"unicode": ""
},
{
"font_class": "eye-slash",
"unicode": ""
},
{
"font_class": "eye-slash-filled",
"unicode": ""
},
{
"font_class": "fire",
"unicode": ""
},
{
"font_class": "fire-filled",
"unicode": ""
},
{
"font_class": "flag",
"unicode": ""
},
{
"font_class": "flag-filled",
"unicode": ""
},
{
"font_class": "folder-add",
"unicode": ""
},
{
"font_class": "folder-add-filled",
"unicode": ""
},
{
"font_class": "font",
"unicode": ""
},
{
"font_class": "forward",
"unicode": ""
},
{
"font_class": "gear",
"unicode": ""
},
{
"font_class": "gear-filled",
"unicode": ""
},
{
"font_class": "gift",
"unicode": ""
},
{
"font_class": "gift-filled",
"unicode": ""
},
{
"font_class": "hand-down",
"unicode": ""
},
{
"font_class": "hand-down-filled",
"unicode": ""
},
{
"font_class": "hand-up",
"unicode": ""
},
{
"font_class": "hand-up-filled",
"unicode": ""
},
{
"font_class": "headphones",
"unicode": ""
},
{
"font_class": "heart",
"unicode": ""
},
{
"font_class": "heart-filled",
"unicode": ""
},
{
"font_class": "help",
"unicode": ""
},
{
"font_class": "help-filled",
"unicode": ""
},
{
"font_class": "home",
"unicode": ""
},
{
"font_class": "home-filled",
"unicode": ""
},
{
"font_class": "image",
"unicode": ""
},
{
"font_class": "image-filled",
"unicode": ""
},
{
"font_class": "images",
"unicode": ""
},
{
"font_class": "images-filled",
"unicode": ""
},
{
"font_class": "info",
"unicode": ""
},
{
"font_class": "info-filled",
"unicode": ""
},
{
"font_class": "left",
"unicode": ""
},
{
"font_class": "link",
"unicode": ""
},
{
"font_class": "list",
"unicode": ""
},
{
"font_class": "location",
"unicode": ""
},
{
"font_class": "location-filled",
"unicode": ""
},
{
"font_class": "locked",
"unicode": ""
},
{
"font_class": "locked-filled",
"unicode": ""
},
{
"font_class": "loop",
"unicode": ""
},
{
"font_class": "mail-open",
"unicode": ""
},
{
"font_class": "mail-open-filled",
"unicode": ""
},
{
"font_class": "map",
"unicode": ""
},
{
"font_class": "map-filled",
"unicode": ""
},
{
"font_class": "map-pin",
"unicode": ""
},
{
"font_class": "map-pin-ellipse",
"unicode": ""
},
{
"font_class": "medal",
"unicode": ""
},
{
"font_class": "medal-filled",
"unicode": ""
},
{
"font_class": "mic",
"unicode": ""
},
{
"font_class": "mic-filled",
"unicode": ""
},
{
"font_class": "micoff",
"unicode": ""
},
{
"font_class": "micoff-filled",
"unicode": ""
},
{
"font_class": "minus",
"unicode": ""
},
{
"font_class": "minus-filled",
"unicode": ""
},
{
"font_class": "more",
"unicode": ""
},
{
"font_class": "more-filled",
"unicode": ""
},
{
"font_class": "navigate",
"unicode": ""
},
{
"font_class": "navigate-filled",
"unicode": ""
},
{
"font_class": "notification",
"unicode": ""
},
{
"font_class": "notification-filled",
"unicode": ""
},
{
"font_class": "paperclip",
"unicode": ""
},
{
"font_class": "paperplane",
"unicode": ""
},
{
"font_class": "paperplane-filled",
"unicode": ""
},
{
"font_class": "person",
"unicode": ""
},
{
"font_class": "person-filled",
"unicode": ""
},
{
"font_class": "personadd",
"unicode": ""
},
{
"font_class": "personadd-filled",
"unicode": ""
},
{
"font_class": "personadd-filled-copy",
"unicode": ""
},
{
"font_class": "phone",
"unicode": ""
},
{
"font_class": "phone-filled",
"unicode": ""
},
{
"font_class": "plus",
"unicode": ""
},
{
"font_class": "plus-filled",
"unicode": ""
},
{
"font_class": "plusempty",
"unicode": ""
},
{
"font_class": "pulldown",
"unicode": ""
},
{
"font_class": "pyq",
"unicode": ""
},
{
"font_class": "qq",
"unicode": ""
},
{
"font_class": "redo",
"unicode": ""
},
{
"font_class": "redo-filled",
"unicode": ""
},
{
"font_class": "refresh",
"unicode": ""
},
{
"font_class": "refresh-filled",
"unicode": ""
},
{
"font_class": "refreshempty",
"unicode": ""
},
{
"font_class": "reload",
"unicode": ""
},
{
"font_class": "right",
"unicode": ""
},
{
"font_class": "scan",
"unicode": ""
},
{
"font_class": "search",
"unicode": ""
},
{
"font_class": "settings",
"unicode": ""
},
{
"font_class": "settings-filled",
"unicode": ""
},
{
"font_class": "shop",
"unicode": ""
},
{
"font_class": "shop-filled",
"unicode": ""
},
{
"font_class": "smallcircle",
"unicode": ""
},
{
"font_class": "smallcircle-filled",
"unicode": ""
},
{
"font_class": "sound",
"unicode": ""
},
{
"font_class": "sound-filled",
"unicode": ""
},
{
"font_class": "spinner-cycle",
"unicode": ""
},
{
"font_class": "staff",
"unicode": ""
},
{
"font_class": "staff-filled",
"unicode": ""
},
{
"font_class": "star",
"unicode": ""
},
{
"font_class": "star-filled",
"unicode": ""
},
{
"font_class": "starhalf",
"unicode": ""
},
{
"font_class": "trash",
"unicode": ""
},
{
"font_class": "trash-filled",
"unicode": ""
},
{
"font_class": "tune",
"unicode": ""
},
{
"font_class": "tune-filled",
"unicode": ""
},
{
"font_class": "undo",
"unicode": ""
},
{
"font_class": "undo-filled",
"unicode": ""
},
{
"font_class": "up",
"unicode": ""
},
{
"font_class": "top",
"unicode": ""
},
{
"font_class": "upload",
"unicode": ""
},
{
"font_class": "upload-filled",
"unicode": ""
},
{
"font_class": "videocam",
"unicode": ""
},
{
"font_class": "videocam-filled",
"unicode": ""
},
{
"font_class": "vip",
"unicode": ""
},
{
"font_class": "vip-filled",
"unicode": ""
},
{
"font_class": "wallet",
"unicode": ""
},
{
"font_class": "wallet-filled",
"unicode": ""
},
{
"font_class": "weibo",
"unicode": ""
},
{
"font_class": "weixin",
"unicode": ""
}
];
const iconUrl = "/assets/uniicons.32e978a5.ttf";
const _style_0$a = { "uni-icons": { "": { "fontFamily": "uniicons", "textDecoration": "none", "textAlign": "center" } } };
const getVal = (val) => {
const reg = /^[0-9]*$/g;
return typeof val === "number" || reg.test(val) ? val + "px" : val;
};
var domModule = weex.requireModule("dom");
domModule.addRule("fontFace", {
"fontFamily": "uniicons",
"src": "url('" + iconUrl + "')"
});
const _sfc_main$c = {
name: "UniIcons",
emits: ["click"],
props: {
type: {
type: String,
default: ""
},
color: {
type: String,
default: "#333333"
},
size: {
type: [Number, String],
default: 16
},
customPrefix: {
type: String,
default: ""
},
fontFamily: {
type: String,
default: ""
}
},
data() {
return {
icons: fontData
};
},
computed: {
unicode() {
let code = this.icons.find((v) => v.font_class === this.type);
if (code) {
return code.unicode;
}
return "";
},
iconSize() {
return getVal(this.size);
},
styleObj() {
if (this.fontFamily !== "") {
return `color: ${this.color}; font-size: ${this.iconSize}; font-family: ${this.fontFamily};`;
}
return `color: ${this.color}; font-size: ${this.iconSize};`;
}
},
methods: {
_onClick() {
this.$emit("click");
}
}
};
function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
return openBlock(), createElementBlock(
"u-text",
{
style: normalizeStyle($options.styleObj),
class: "uni-icons",
onClick: _cache[0] || (_cache[0] = (...args) => $options._onClick && $options._onClick(...args))
},
toDisplayString($options.unicode),
5
/* TEXT, STYLE */
);
}
const __easycom_0 = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["render", _sfc_render$c], ["styles", [_style_0$a]], ["__file", "D:/document/九亿商城/jy/jiuyi2/uni_modules/uni-icons/components/uni-icons/uni-icons.vue"]]);
const nvueAnimation = requireNativePlugin("animation");
class MPAnimation {
constructor(options, _this) {
this.options = options;
this.animation = uni.createAnimation({
...options
});
this.currentStepAnimates = {};
this.next = 0;
this.$ = _this;
}
_nvuePushAnimates(type, args) {
let aniObj = this.currentStepAnimates[this.next];
let styles = {};
if (!aniObj) {
styles = {
styles: {},
config: {}
};
} else {
styles = aniObj;
}
if (animateTypes1.includes(type)) {
if (!styles.styles.transform) {
styles.styles.transform = "";
}
let unit = "";
if (type === "rotate") {
unit = "deg";
}
styles.styles.transform += `${type}(${args + unit}) `;
} else {
styles.styles[type] = `${args}`;
}
this.currentStepAnimates[this.next] = styles;
}
_animateRun(styles = {}, config2 = {}) {
let ref2 = this.$.$refs["ani"].ref;
if (!ref2)
return;
return new Promise((resolve, reject) => {
nvueAnimation.transition(ref2, {
styles,
...config2
}, (res) => {
resolve();
});
});
}
_nvueNextAnimate(animates, step = 0, fn) {
let obj = animates[step];
if (obj) {
let {
styles,
config: config2
} = obj;
this._animateRun(styles, config2).then(() => {
step += 1;
this._nvueNextAnimate(animates, step, fn);
});
} else {
this.currentStepAnimates = {};
typeof fn === "function" && fn();
this.isEnd = true;
}
}
step(config2 = {}) {
this.currentStepAnimates[this.next].config = Object.assign({}, this.options, config2);
this.currentStepAnimates[this.next].styles.transformOrigin = this.currentStepAnimates[this.next].config.transformOrigin;
this.next++;
return this;
}
run(fn) {
this.isEnd = false;
let ref2 = this.$.$refs["ani"] && this.$.$refs["ani"].ref;
if (!ref2)
return;
this._nvueNextAnimate(this.currentStepAnimates, 0, fn);
this.next = 0;
}
}
const animateTypes1 = [
"matrix",
"matrix3d",
"rotate",
"rotate3d",
"rotateX",
"rotateY",
"rotateZ",
"scale",
"scale3d",
"scaleX",
"scaleY",
"scaleZ",
"skew",
"skewX",
"skewY",
"translate",
"translate3d",
"translateX",
"translateY",
"translateZ"
];
const animateTypes2 = ["opacity", "backgroundColor"];
const animateTypes3 = ["width", "height", "left", "right", "top", "bottom"];
animateTypes1.concat(animateTypes2, animateTypes3).forEach((type) => {
MPAnimation.prototype[type] = function(...args) {
this._nvuePushAnimates(type, args);
return this;
};
});
function createAnimation(option, _this) {
if (!_this)
return;
clearTimeout(_this.timer);
return new MPAnimation(option, _this);
}
const _sfc_main$b = {
name: "uniTransition",
emits: ["click", "change"],
props: {
show: {
type: Boolean,
default: false
},
modeClass: {
type: [Array, String],
default() {
return "fade";
}
},
duration: {
type: Number,
default: 300
},
styles: {
type: Object,
default() {
return {};
}
},
customClass: {
type: String,
default: ""
},
onceRender: {
type: Boolean,
default: false
}
},
data() {
return {
isShow: false,
transform: "",
opacity: 1,
animationData: {},
durationTime: 300,
config: {}
};
},
watch: {
show: {
handler(newVal) {
if (newVal) {
this.open();
} else {
if (this.isShow) {
this.close();
}
}
},
immediate: true
}
},
computed: {
// 生成样式数据
stylesObject() {
let styles = {
...this.styles,
"transition-duration": this.duration / 1e3 + "s"
};
let transform = "";
for (let i in styles) {
let line = this.toLine(i);
transform += line + ":" + styles[i] + ";";
}
return transform;
},
// 初始化动画条件
transformStyles() {
return "transform:" + this.transform + ";opacity:" + this.opacity + ";" + this.stylesObject;
}
},
created() {
this.config = {
duration: this.duration,
timingFunction: "ease",
transformOrigin: "50% 50%",
delay: 0
};
this.durationTime = this.duration;
},
methods: {
/**
* ref 触发 初始化动画
*/
init(obj = {}) {
if (obj.duration) {
this.durationTime = obj.duration;
}
this.animation = createAnimation(Object.assign(this.config, obj), this);
},
/**
* 点击组件触发回调
*/
onClick() {
this.$emit("click", {
detail: this.isShow
});
},
/**
* ref 触发 动画分组
* @param {Object} obj
*/
step(obj, config2 = {}) {
if (!this.animation)
return;
for (let i in obj) {
try {
if (typeof obj[i] === "object") {
this.animation[i](...obj[i]);
} else {
this.animation[i](obj[i]);
}
} catch (e) {
formatAppLog("error", "at uni_modules/uni-transition/components/uni-transition/uni-transition.vue:148", `方法 ${i} 不存在`);
}
}
this.animation.step(config2);
return this;
},
/**
* ref 触发 执行动画
*/
run(fn) {
if (!this.animation)
return;
this.animation.run(fn);
},
// 开始过度动画
open() {
clearTimeout(this.timer);
this.transform = "";
this.isShow = true;
let { opacity, transform } = this.styleInit(false);
if (typeof opacity !== "undefined") {
this.opacity = opacity;
}
this.transform = transform;
this.$nextTick(() => {
this.timer = setTimeout(() => {
this.animation = createAnimation(this.config, this);
this.tranfromInit(false).step();
this.animation.run();
this.$emit("change", {
detail: this.isShow
});
}, 20);
});
},
// 关闭过度动画
close(type) {
if (!this.animation)
return;
this.tranfromInit(true).step().run(() => {
this.isShow = false;
this.animationData = null;
this.animation = null;
let { opacity, transform } = this.styleInit(false);
this.opacity = opacity || 1;
this.transform = transform;
this.$emit("change", {
detail: this.isShow
});
});
},
// 处理动画开始前的默认样式
styleInit(type) {
let styles = {
transform: ""
};
let buildStyle = (type2, mode) => {
if (mode === "fade") {
styles.opacity = this.animationType(type2)[mode];
} else {
styles.transform += this.animationType(type2)[mode] + " ";
}
};
if (typeof this.modeClass === "string") {
buildStyle(type, this.modeClass);
} else {
this.modeClass.forEach((mode) => {
buildStyle(type, mode);
});
}
return styles;
},
// 处理内置组合动画
tranfromInit(type) {
let buildTranfrom = (type2, mode) => {
let aniNum = null;
if (mode === "fade") {
aniNum = type2 ? 0 : 1;
} else {
aniNum = type2 ? "-100%" : "0";
if (mode === "zoom-in") {
aniNum = type2 ? 0.8 : 1;
}
if (mode === "zoom-out") {
aniNum = type2 ? 1.2 : 1;
}
if (mode === "slide-right") {
aniNum = type2 ? "100%" : "0";
}
if (mode === "slide-bottom") {
aniNum = type2 ? "100%" : "0";
}
}
this.animation[this.animationMode()[mode]](aniNum);
};
if (typeof this.modeClass === "string") {
buildTranfrom(type, this.modeClass);
} else {
this.modeClass.forEach((mode) => {
buildTranfrom(type, mode);
});
}
return this.animation;
},
animationType(type) {
return {
fade: type ? 0 : 1,
"slide-top": `translateY(${type ? "0" : "-100%"})`,
"slide-right": `translateX(${type ? "0" : "100%"})`,
"slide-bottom": `translateY(${type ? "0" : "100%"})`,
"slide-left": `translateX(${type ? "0" : "-100%"})`,
"zoom-in": `scaleX(${type ? 1 : 0.8}) scaleY(${type ? 1 : 0.8})`,
"zoom-out": `scaleX(${type ? 1 : 1.2}) scaleY(${type ? 1 : 1.2})`
};
},
// 内置动画类型与实际动画对应字典
animationMode() {
return {
fade: "opacity",
"slide-top": "translateY",
"slide-right": "translateX",
"slide-bottom": "translateY",
"slide-left": "translateX",
"zoom-in": "scale",
"zoom-out": "scale"
};
},
// 驼峰转中横线
toLine(name) {
return name.replace(/([A-Z])/g, "-$1").toLowerCase();
}
}
};
function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
return $data.isShow ? (openBlock(), createElementBlock("view", {
key: 0,
ref: "ani",
animation: $data.animationData,
class: normalizeClass($props.customClass),
style: normalizeStyle($options.transformStyles),
onClick: _cache[0] || (_cache[0] = (...args) => $options.onClick && $options.onClick(...args)),
renderWhole: true
}, [
renderSlot(_ctx.$slots, "default")
], 14, ["animation"])) : createCommentVNode("v-if", true);
}
const __easycom_1$2 = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["render", _sfc_render$b], ["__file", "D:/document/九亿商城/jy/jiuyi2/uni_modules/uni-transition/components/uni-transition/uni-transition.vue"]]);
const _style_0$9 = { "uni-popup": { "": { "position": "fixed" }, ".top": { "top": 0 }, ".left": { "top": 0 }, ".right": { "top": 0 } }, "uni-popup__wrapper": { ".uni-popup ": { "position": "relative" }, ".uni-popup .left": { "paddingTop": 0, "flex": 1 }, ".uni-popup .right": { "paddingTop": 0, "flex": 1 } }, "fixforpc-top": { "": { "top": 0 } } };
const _sfc_main$a = {
name: "uniPopup",
components: {},
emits: ["change", "maskClick"],
props: {
// 开启动画
animation: {
type: Boolean,
default: true
},
// 弹出层类型可选值top: 顶部弹出层bottom底部弹出层center全屏弹出层
// message: 消息提示 ; dialog : 对话框
type: {
type: String,
default: "center"
},
// maskClick
isMaskClick: {
type: Boolean,
default: null
},
// TODO 2 个版本后废弃属性 ,使用 isMaskClick
maskClick: {
type: Boolean,
default: null
},
backgroundColor: {
type: String,
default: "none"
},
safeArea: {
type: Boolean,
default: true
},
maskBackgroundColor: {
type: String,
default: "rgba(0, 0, 0, 0.4)"
},
borderRadius: {
type: String
}
},
watch: {
/**
* 监听type类型
*/
type: {
handler: function(type) {
if (!this.config[type])
return;
this[this.config[type]](true);
},
immediate: true
},
isDesktop: {
handler: function(newVal) {
if (!this.config[newVal])
return;
this[this.config[this.type]](true);
},
immediate: true
},
/**
* 监听遮罩是否可点击
* @param {Object} val
*/
maskClick: {
handler: function(val) {
this.mkclick = val;
},
immediate: true
},
isMaskClick: {
handler: function(val) {
this.mkclick = val;
},
immediate: true
},
// H5 下禁止底部滚动
showPopup(show) {
}
},
data() {
return {
duration: 300,
ani: [],
showPopup: false,
showTrans: false,
popupWidth: 0,
popupHeight: 0,
config: {
top: "top",
bottom: "bottom",
center: "center",
left: "left",
right: "right",
message: "top",
dialog: "center",
share: "bottom"
},
maskClass: {
position: "fixed",
bottom: 0,
top: 0,
left: 0,
right: 0,
backgroundColor: "rgba(0, 0, 0, 0.4)"
},
transClass: {
backgroundColor: "transparent",
borderRadius: this.borderRadius || "0",
position: "fixed",
left: 0,
right: 0
},
maskShow: true,
mkclick: true,
popupstyle: "top"
};
},
computed: {
getStyles() {
let res = { backgroundColor: this.bg };
if (this.borderRadius || "0") {
res = Object.assign(res, { borderRadius: this.borderRadius });
}
return res;
},
isDesktop() {
return this.popupWidth >= 500 && this.popupHeight >= 500;
},
bg() {
if (this.backgroundColor === "" || this.backgroundColor === "none") {
return "transparent";
}
return this.backgroundColor;
}
},
mounted() {
const fixSize = () => {
const {
windowWidth,
windowHeight,
windowTop,
safeArea,
screenHeight,
safeAreaInsets
} = uni.getSystemInfoSync();
this.popupWidth = windowWidth;
this.popupHeight = windowHeight + (windowTop || 0);
if (safeArea && this.safeArea) {
this.safeAreaInsets = safeAreaInsets.bottom;
} else {
this.safeAreaInsets = 0;
}
};
fixSize();
},
// TODO vue3
unmounted() {
this.setH5Visible();
},
activated() {
this.setH5Visible(!this.showPopup);
},
deactivated() {
this.setH5Visible(true);
},
created() {
if (this.isMaskClick === null && this.maskClick === null) {
this.mkclick = true;
} else {
this.mkclick = this.isMaskClick !== null ? this.isMaskClick : this.maskClick;
}
if (this.animation) {
this.duration = 300;
} else {
this.duration = 0;
}
this.messageChild = null;
this.clearPropagation = false;
this.maskClass.backgroundColor = this.maskBackgroundColor;
},
methods: {
setH5Visible(visible = true) {
},
/**
* 公用方法,不显示遮罩层
*/
closeMask() {
this.maskShow = false;
},
/**
* 公用方法,遮罩层禁止点击
*/
disableMask() {
this.mkclick = false;
},
// TODO nvue 取消冒泡
clear(e) {
this.clearPropagation = true;
},
open(direction) {
if (this.showPopup) {
return;
}
let innerType = ["top", "center", "bottom", "left", "right", "message", "dialog", "share"];
if (!(direction && innerType.indexOf(direction) !== -1)) {
direction = this.type;
}
if (!this.config[direction]) {
formatAppLog("error", "at uni_modules/uni-popup/components/uni-popup/uni-popup.vue:298", "缺少类型:", direction);
return;
}
this[this.config[direction]]();
this.$emit("change", {
show: true,
type: direction
});
},
close(type) {
this.showTrans = false;
this.$emit("change", {
show: false,
type: this.type
});
clearTimeout(this.timer);
this.timer = setTimeout(() => {
this.showPopup = false;
}, 300);
},
// TODO 处理冒泡事件,头条的冒泡事件有问题 ,先这样兼容
touchstart() {
this.clearPropagation = false;
},
onTap() {
if (this.clearPropagation) {
this.clearPropagation = false;
return;
}
this.$emit("maskClick");
if (!this.mkclick)
return;
this.close();
},
/**
* 顶部弹出样式处理
*/
top(type) {
this.popupstyle = this.isDesktop ? "fixforpc-top" : "top";
this.ani = ["slide-top"];
this.transClass = {
position: "fixed",
left: 0,
right: 0,
backgroundColor: this.bg,
borderRadius: this.borderRadius || "0"
};
if (type)
return;
this.showPopup = true;
this.showTrans = true;
this.$nextTick(() => {
if (this.messageChild && this.type === "message") {
this.messageChild.timerClose();
}
});
},
/**
* 底部弹出样式处理
*/
bottom(type) {
this.popupstyle = "bottom";
this.ani = ["slide-bottom"];
this.transClass = {
position: "fixed",
left: 0,
right: 0,
bottom: 0,
paddingBottom: this.safeAreaInsets + "px",
backgroundColor: this.bg,
borderRadius: this.borderRadius || "0"
};
if (type)
return;
this.showPopup = true;
this.showTrans = true;
},
/**
* 中间弹出样式处理
*/
center(type) {
this.popupstyle = "center";
this.ani = ["zoom-out", "fade"];
this.transClass = {
position: "fixed",
bottom: 0,
left: 0,
right: 0,
top: 0,
justifyContent: "center",
alignItems: "center",
borderRadius: this.borderRadius || "0"
};
if (type)
return;
this.showPopup = true;
this.showTrans = true;
},
left(type) {
this.popupstyle = "left";
this.ani = ["slide-left"];
this.transClass = {
position: "fixed",
left: 0,
bottom: 0,
top: 0,
backgroundColor: this.bg,
borderRadius: this.borderRadius || "0"
};
if (type)
return;
this.showPopup = true;
this.showTrans = true;
},
right(type) {
this.popupstyle = "right";
this.ani = ["slide-right"];
this.transClass = {
position: "fixed",
bottom: 0,
right: 0,
top: 0,
backgroundColor: this.bg,
borderRadius: this.borderRadius || "0"
};
if (type)
return;
this.showPopup = true;
this.showTrans = true;
}
}
};
function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
const _component_uni_transition = resolveEasycom(resolveDynamicComponent("uni-transition"), __easycom_1$2);
return $data.showPopup ? (openBlock(), createElementBlock(
"view",
{
key: 0,
class: normalizeClass(["uni-popup", [$data.popupstyle, $options.isDesktop ? "fixforpc-z-index" : ""]]),
renderWhole: true
},
[
createElementVNode(
"view",
{
onTouchstart: _cache[1] || (_cache[1] = (...args) => $options.touchstart && $options.touchstart(...args))
},
[
$data.maskShow ? (openBlock(), createBlock(_component_uni_transition, {
key: "1",
name: "mask",
"mode-class": "fade",
styles: $data.maskClass,
duration: $data.duration,
show: $data.showTrans,
onClick: $options.onTap
}, null, 8, ["styles", "duration", "show", "onClick"])) : createCommentVNode("v-if", true),
createVNode(_component_uni_transition, {
key: "2",
"mode-class": $data.ani,
name: "content",
styles: $data.transClass,
duration: $data.duration,
show: $data.showTrans,
onClick: $options.onTap
}, {
default: withCtx(() => [
createElementVNode(
"view",
{
class: normalizeClass(["uni-popup__wrapper", [$data.popupstyle]]),
style: normalizeStyle($options.getStyles),
onClick: _cache[0] || (_cache[0] = (...args) => $options.clear && $options.clear(...args))
},
[
renderSlot(_ctx.$slots, "default")
],
6
/* CLASS, STYLE */
)
]),
_: 3
/* FORWARDED */
}, 8, ["mode-class", "styles", "duration", "show", "onClick"])
],
32
/* NEED_HYDRATION */
)
],
2
/* CLASS */
)) : createCommentVNode("v-if", true);
}
const __easycom_1$1 = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["render", _sfc_render$a], ["styles", [_style_0$9]], ["__file", "D:/document/九亿商城/jy/jiuyi2/uni_modules/uni-popup/components/uni-popup/uni-popup.vue"]]);
const store = createStore({
state: {
// 用户信息
userinfo: {},
// tabbar当前的模式 default视频端 shop商城端
tabbarMode: "default",
// 闹钟时间
alarmTime: "",
// 资产
purse: {
balance: 0,
fruit: 0,
score: 0,
seed: 0
},
// 任务
task: {
//任务类型 0.任务读秒 1.流量点(种子)读秒
taskType: 0,
//有效时长
viewingDuration: 0
}
},
mutations: {
// 获取内容
setState(state, option) {
const key = option.key;
const value = option.value;
state[key] = value;
},
// 设置用户信息
setUserInfo(state, value) {
state.userinfo = value;
},
// 设置 tabbar 模式
setTabbarMode(state, mode) {
state.tabbarMode = mode;
}
},
getters: {
getUserInfo(state) {
return state.userinfo;
},
getTabbarMode(state) {
return state.tabbarMode;
}
},
actions: {
updateUserInfo({
commit
}, payload) {
commit("setUserInfo", payload);
},
changeTabbarMode({
commit
}, mode) {
commit("setTabbarMode", mode);
}
}
});
const config = {
// 接口域名
host: "http://5310d716.r22.cpolar.top",
// host: 'http://192.168.1.236:8080',
// 上传文件二级路径
uploadFilePath: "/homecommon/file/preview?fileName=",
// 上传视频二级路径
uploadVideoPath: "/homecommon/file/play?fileName=",
// 图片大小 单位m
img_size: 5,
// 视频限制大小 单位m
video_size: 300,
// h5路径
h5: "",
// 腾讯im聊天
TChat: {
// appid
SDKAppID: "1600057470",
// 验签
secretKey: "7d016821bf27a846739e209534abe4c4bba131559b3318e19f8ccf9294e08b29",
//
userSig: ""
}
};
const login = {
/**
* 用户注册
* @param {Object} param
*/
userRegister(param) {
return util$1.request({
url: `/user/register`,
data: param.data,
load: true
});
},
/**
* 获取验证码
* @param {Object} param
*/
getCaptcha(param) {
return util$1.request({
url: "/user/sendVerifyCode",
query: param.query,
method: "GET"
});
},
/**
* 用户密码登录接口
* @param {Object} param
*/
userLoginByPassword(param) {
return util$1.request({
url: "/user/login",
data: param.data,
load: true
});
},
/**
* 修改用户密码
* @param {Object} param
*/
resetPassword(param) {
return util$1.request({
url: "/user/login/resetPassword",
data: param.data,
path: param.path,
method: "POST"
});
},
/**
* 获取IMtoken
* @param {Object} param
*/
getIMToken(param) {
return util$1.request({
url: "/user/chat/getUserSig",
query: param.query,
method: "GET"
});
}
};
const mine = {
/**
* 获取用户信息
* @param {Object} param
*/
getUserinfo(param) {
return util$1.request({
url: `/user/getUserData`,
method: "GET"
});
},
/**
* 修改用户信息
* @param {Object} param
*/
updateUserInfo(param) {
return util$1.request({
url: `/user/updateUserData`,
data: param.data,
method: "PUT",
load: 1
});
},
/**
* 获取我的评论
* @param {Object} param
*/
myComment(param) {
return util$1.request({
url: `/user/home/myComment`,
query: param.query,
method: "POST"
});
},
// 实名认证
certification(param) {
return util$1.request({
url: `/user/info/certification`,
data: param.data,
method: "POST",
load: true
});
},
/**
* 查询我的钱包接口
* @param {Object} param
*/
selectPurse(param) {
return util$1.request({
url: "/user/selectPurse",
method: "GET"
});
},
/**
* 获取待释放列表
* @param {Object} param
*/
releasedList(param) {
return util$1.request({
url: "/user/released/list",
query: param.query,
method: "GET"
});
},
/**
* 根据用户账号查询用户id
* @param {Object} param
*/
getUserDataByAccount(param) {
return util$1.request({
url: "/coreplay/app/durian/getUserDataByAccount",
query: param.query,
method: "GET"
});
},
/**
* 设置二级密码
* @param {Object} param
*/
setSecondLevelCipher(param) {
return util$1.request({
url: "/user/user/setSecondLevelCipher",
data: param.data,
method: "POST"
});
},
/**
* 验证二级密码
* @param {Object} param
*/
checkSecondLevelCipher(param) {
return util$1.request({
url: "/user/user/checkSecondLevelCipher",
data: param.data,
method: "POST"
});
}
};
const video = {
/**
* 申请完播量
* @param {Object} param
*/
applyVideo(param) {
return util$1.request({
url: `/homecommon/applyVideo`,
query: param.query,
data: param.data,
method: "POST",
load: true
});
},
/**
* 展播量推送
* @param {Object} param
*/
pushVideo(param) {
return util$1.request({
url: `/homecommon/pushVideo`,
query: param.query,
method: "POST",
load: true
});
},
/**
* 他人用户主页
* @param {Object} param
*/
getUserInfo(param) {
return util$1.request({
url: `/home/getUserInfo`,
query: param.query,
method: "POST",
load: true
});
},
/**
* 用户视频列表
* @param {Object} param
*/
myVideoList(param) {
return util$1.request({
url: `/home/myVideoList`,
query: param.query,
method: "POST",
load: true
});
},
/**
* 我的收藏列表
* @param {Object} param
*/
getCollectList(param) {
return util$1.request({
url: `/collect/getCollectList`,
query: param.query,
method: "POST"
});
},
/**
* 新建收藏夹
* @param {Object} param
*/
saveCollectList(param) {
return util$1.request({
url: `/collect/saveCollectList`,
query: param.query,
method: "POST",
load: true
});
},
/**
* 编辑收藏夹
* @param {Object} param
*/
updateCollectList(param) {
return util$1.request({
url: `/collect/updateCollectList`,
query: param.query,
method: "POST",
load: true
});
},
/**
* 删除收藏夹
* @param {Object} param
*/
deleteCollect(param) {
return util$1.request({
url: `/collect/deleteCollect`,
query: param.query,
load: true,
method: "POST"
});
},
/**
* 我的收藏视频列表
* @param {Object} param
*/
getCollectVideoList(param) {
return util$1.request({
url: `/collect/getCollectVideoList`,
query: param.query,
load: true,
method: "POST"
});
},
/**
* 收藏视频
* @param {Object} param
*/
collectVideo(param) {
return util$1.request({
url: `/collect/collectVideo`,
query: param.query,
method: "POST",
load: true
});
},
/**
* 取消收藏
* @param {Object} param
*/
cancelCollect(param) {
return util$1.request({
url: `/collect/cancelCollect`,
query: param.query,
method: "POST",
load: true
});
},
/**
* 首页视频分页接口
* @param {Object} param
*/
homeVideo(param) {
return util$1.request({
url: `/video/video/list`,
query: param.query,
method: "GET"
});
},
/**
* 我的关注视频列表
* @param {Object} param
*/
followVideo(param) {
return util$1.request({
url: `/homecommon/followVideo`,
query: param.query,
method: "POST"
});
},
/**
* 查看标签分类
* @param {Object} param
*/
getLabel(param) {
return util$1.request({
url: `/video/tag/list`,
query: param.query,
method: "GET",
load: true
});
},
/**
* 新增或编辑标签
* @param {Object} param
*/
setLabel(param) {
return util$1.request({
url: `/video/tag/add`,
query: param.query,
method: "POST",
load: true
});
},
/**
* 发布作品
* @param {Object} param
*/
publishVideo(param) {
return util$1.request({
url: `/video/video/add`,
data: param.data,
method: "POST"
});
},
/**
* 修改视频信息接口
* @param {Object} param
*/
updateVideo(param) {
return util$1.request({
url: `/homecommon/updateVideo`,
data: param.data,
method: "POST"
});
},
/**
* 视频评论列表
* @param {Object} param
*/
commentList(param) {
return util$1.request({
url: `/home/commentList`,
query: param.query,
method: "POST"
});
},
/**
* 下级评论列表
* @param {Object} param
*/
levelCommentList(param) {
return util$1.request({
url: `/home/levelCommentList`,
query: param.query,
method: "POST"
});
},
/**
* 点赞/取消点赞接口 0取消 1点赞
* @param {Object} param
*/
thumbsUp(param) {
return util$1.request({
url: `/home/thumbsUp`,
query: param.query,
method: "POST"
});
},
/**
* 发表评论
* @param {Object} param
*/
comment(param) {
return util$1.request({
url: `/home/comment`,
query: param.query,
method: "POST"
});
},
/**
* 视频 点赞取消赞
* @param {Object} param
*/
videoLike(param) {
return util$1.request({
url: `/home/videoLike`,
query: param.query,
method: "POST"
});
},
/**
* 观看视频记录接口
* @param {Object} param
*/
browseLog(param) {
return util$1.request({
url: `/video/Effective/second`,
data: param.data,
method: "POST"
});
},
/**
* 热点视频
* @param {Object} param
*/
hotVideos(param) {
return util$1.request({
url: `/home/hotVideos`,
// query: param.query,
method: "POST"
});
},
/**
* 视频搜索记录
* @param {Object} param
*/
videoSearchLog(param) {
return util$1.request({
url: `/home/videoSearchLog`,
// query: param.query,
method: "POST"
});
},
/**
* 视频模糊搜索
* @param {Object} param
*/
videoSearch(param) {
return util$1.request({
url: `/home/videoSearch`,
query: param.query,
method: "POST"
});
},
/**
* 同意好友申请
* @param {Object} param
*/
agreeFriend(param) {
return util$1.request({
url: `/user/friend/agreeFriend`,
path: param.path,
query: param.query,
method: "POST"
});
},
/**
* 拒绝好友申请
* @param {Object} param
*/
refuseFriend(param) {
return util$1.request({
url: `/user/friend/refuseFriend`,
path: param.path,
query: param.query,
method: "POST"
});
},
/**
* 好友列表
* @param {Object} param
*/
getFriendList(param) {
return util$1.request({
url: `/user/friend/getFriendList`,
path: param.path,
query: param.query,
method: "GET"
});
},
/**
* 关注列表
* @param {Object} param
*/
getFansList(param) {
return util$1.request({
url: `/user/attention/getFansList`,
path: param.path,
query: param.query,
method: "GET"
});
},
/**
* 关注列表
* @param {Object} param
*/
getAttentionList(param) {
return util$1.request({
url: `/user/attention/getAttentionList`,
path: param.path,
query: param.query,
method: "GET"
});
},
/**
* 关注用户 关注状态 0:取关 1:关注
* @param {Object} param
*/
attention(param) {
return util$1.request({
url: `/user/attention`,
path: param.path,
data: param.data,
method: "POST"
});
},
/**
* 视频观看权限 (不看他) 0拉黑 1放出
* @param {Object} param
*/
videoBlock(param) {
return util$1.request({
url: `/home/videoBlock`,
query: param.query,
load: true,
method: "POST"
});
},
/**
* 举报视频
* @param {Object} param
*/
reportVideo(param) {
return util$1.request({
url: `/report/reportVideo`,
data: param.data,
method: "POST"
});
},
/**
* 我的喜欢视频列表 分页
* @param {Object} param
*/
myLikeVideoList(param) {
return util$1.request({
url: `/home/myLikeVideoList`,
query: param.query,
method: "POST"
});
},
/**
* 视频详情
* @param {Object} param
*/
getVideoById(param) {
return util$1.request({
url: `/homecommon/getVideoById`,
query: param.query,
method: "POST"
});
},
/**
* 视频分享
* @param {Object} param
*/
videoShare(param) {
return util$1.request({
url: `/home/videoShare`,
query: param.query,
method: "POST"
});
},
/**
* 设置闹铃
* @param {Object} param
*/
setAlarm(param) {
return util$1.request({
url: `/home/setAlarm`,
query: param.query,
method: "POST"
});
},
/**
* 查看自己的闹铃
*/
getAlarm() {
return util$1.request({
url: `/home/getAlarm`,
method: "POST"
});
},
/**
* 查看我的今日观看任务
*/
viewingTasks() {
return util$1.request({
url: `/home/viewingTasks`,
method: "POST"
});
}
};
const news = {
/**
* 获取腾讯云用户签名
* @param {Object} param
*/
getUserSig(param) {
return util$1.request({
url: `/user/chat/getUserSig`,
method: "GET",
query: param.query
});
},
/**
* 设置好友备注
* @param {Object} param
*/
setNotes(param) {
return util$1.request({
url: `/user/friend/setNotes`,
method: "POST",
query: param.query
});
},
/**
* 删除好友
* @param {Object} param
*/
deleteFriend(param) {
return util$1.request({
url: `/user/friend/deleteFriend`,
method: "POST",
path: param.path
});
},
/**
* 添加好友
* @param {Object} param
*/
addFriend(param) {
return util$1.request({
url: `/user/friend/addFriend`,
method: "POST",
path: param.path
});
},
/**
* 好友申请列表-分页
* @param {Object} param
*/
getFriendListPage(param) {
return util$1.request({
url: `/user/friend/getFriendListPage`,
path: param.path,
query: param.query,
method: "GET"
});
},
/**
* 根据用户名模糊搜索好友-分页
* @param {Object} param
*/
searchFriendByName(param) {
return util$1.request({
url: `/user/friend/searchFriendByName`,
path: param.path,
query: param.query,
method: "GET"
});
},
/**
* 商品列表
* @param {Object} param
*/
getImToken(param) {
return util$1.request({
url: `/im/token/getUserAppToken`,
method: "get",
query: param
});
},
/**
* 商品列表
* @param {Object} param
*/
sendRedBag(param) {
return util$1.request({
url: `/home/sendRedBag`,
method: "POST",
data: param.data
});
},
// 抢红包
grabred(param) {
return util$1.request({
url: `/home/grabred`,
method: "POST",
data: param.data
});
},
// 红包详情
getRedbag(param) {
return util$1.request({
url: `/home/getRedbag`,
method: "POST",
query: param.data
});
},
grabredLog(param) {
return util$1.request({
url: `/home/grabredLog`,
method: "POST",
query: param
});
}
};
const team = {
/**
* 我的团队
* @param {Object} param
*/
myTeam(param = {}) {
return util$1.request({
url: `/user/team/get`,
query: param,
method: "GET"
});
},
lowTeam(param) {
return util$1.request({
url: `/home/lowTeam`,
method: "post",
query: param.query
});
}
};
const intergral = {
/**
* 卷轴列表
* @param {Object} param
*/
scrollList(param) {
return util$1.request({
url: `/coreplay/app/scrollinfo/scroll-list`,
method: "GET",
query: param.query,
load: true
});
},
/**
* 我购买的卷轴列表
* @param {Object} param
*/
buyScrollList(param) {
return util$1.request({
url: `/coreplay/app/scrollinfo/boughtListByUser`,
method: "GET",
load: true
});
},
/**
* 查看卷轴按id
* @param {Object} param
*/
scrollinfo(param) {
return util$1.request({
url: `/coreplay/app/scrollinfo`,
method: "GET",
path: param.path,
load: true
});
},
/**
* 按用户id按日期查卷轴积分明细
* @param {Object} param
*/
getDetailInfoByDate(param) {
return util$1.request({
url: `/coreplay/app/scrollinfo/getDetailInfoByDate`,
method: "GET",
query: param.query
});
},
/**
* 按卷轴id查卷轴积分明细
* @param {Object} param
*/
getDetailInfoByScrollId(param) {
return util$1.request({
url: `/coreplay/app/scrollinfo/getDetailInfoByScrollId`,
method: "GET",
path: param.path,
query: param.query
});
},
/**
* 按用户id查卷轴积分明细
* @param {Object} param
*/
getDetailInfoByUserId(param) {
return util$1.request({
url: `/coreplay/app/scrollinfo/getDetailInfoByUserId`,
method: "GET",
query: param.query
});
},
/**
* 今日任务读秒记录
* @param {Object} param
*/
viewingTasks(param) {
return util$1.request({
url: `/video/Effective/return`,
method: "GET",
query: param.query
});
},
/**
* 购买卷轴
* @param {Object} param
*/
buyScroll(param) {
return util$1.request({
url: `/coreplay/app/scrollinfo/buyScroll`,
method: "POST",
data: param.data
});
}
};
const durian = {
/**
* 果树列表
* @param {Object} param
*/
durianList(param) {
return util$1.request({
url: `/coreplay/duriantreeinfo/tree-list`,
method: "GET",
query: param.query
});
},
/**
* 我的榴莲果树
* @param {Object} param
*/
buyDurianList(param) {
return util$1.request({
url: `/coreplay/duriantreeinfo/boughtListByUser`,
method: "GET",
query: param.query
});
},
/**
* 榴莲果置换
* @param {Object} param
*/
exchange(param) {
return util$1.request({
url: `/coreplay/duriantreeinfo/exchange`,
method: "POST",
data: param.data,
load: true
});
},
/**
* 校验姓名
* @param {Object} param
*/
nameComparison(param) {
return util$1.request({
url: `/coreplay/app/durian/nameComparison`,
method: "GET",
query: param.query,
load: true
});
},
/**
* 交易榴莲果
* @param {Object} param
*/
consume(param) {
return util$1.request({
url: `/coreplay/app/durian/consume`,
method: "POST",
data: param.data,
load: true
});
}
};
const shop = {
/**
* 商品列表
* @param {Object} param
*/
getProduct(param) {
return util$1.request({
url: `/appProductionApi/getProductionList`,
method: "GET",
data: param.data
});
},
/**
* 商品列表
* @param {Object} param
*/
getCategory(param) {
return util$1.request({
url: `/appProductionApi/getProductCategory`,
method: "GET",
query: param.query
});
},
/**
* 根据商品主键获取商品详情
* @param {Object} param
*/
productDetail(param) {
return util$1.request({
url: `/appProductionApi/getProductionDetail`,
method: "GET",
query: param.query
});
}
};
const api = {
// 登录
login,
// 我的
mine,
// 视频模块
video,
// 消息
news,
// 我的团队
team,
// 积分
intergral,
// 榴莲果
durian,
// 商城模块
shop,
// 上传图片地址
uploadImg: "/homecommon/upload",
// 上传视频地址
uploadVideo: "/homecommon/uploadVideo",
// 公共模块可以放在这里 比如获取各种文章
/**
* 获取文章
* @param {Object} param
*/
getArticle(param) {
return util$1.request({
url: "/home/getArticle",
query: param.query,
method: "POST"
});
},
/**
* 获取各种配置
* @param {Object} param
*/
getConfig() {
return util$1.request({
url: "/coreplay/configinfo/getConf",
method: "GET"
});
}
};
const util = {
// 配置参数
config,
// 正则
reg: {
// 手机号
tel: /^1[3-9]\d{9}$/,
// 身份证
idCard: /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/
},
/**
* 弹窗
* @param {Object|String} obj String类型只是弹出文字 object如下
* @param {String} obj.title 弹窗的标题
* @param {String} obj.content 弹窗的内容
* @param {String} obj.confirmText 确定的文本
* @param {String} obj.showCancel 是否显示取消
* @param {String} obj.cancelText 取消的文本
* @param {Function} params.success 请求成功回调 可通过promise.then捕获
* @param {Function} params.fail 请求失败回调 可通过promise.catch捕获
* @param {Function} params.complete 请求结束回调 无论是否成功失败都会执行
* @return {Object} string返回null object返回返回promis对象 执行成功返回resolve 执行失败返回reject
*/
alert(obj) {
if (obj == null || obj == void 0)
return;
if (typeof obj == "string" || typeof obj == "number") {
uni.showToast({
"title": "" + obj,
"icon": "none",
duration: 3e3
});
return null;
}
obj.title = obj.title ? obj.title : "";
obj.content = obj.content ? obj.content : "";
obj.confirmText = obj.confirmText ? obj.confirmText : "确定";
obj.showCancel = obj.showCancel === false ? false : true;
obj.cancelText = obj.cancelText ? obj.cancelText : "取消";
return new Promise((resolve, reject) => {
uni.showModal({
title: obj.title,
content: obj.content,
confirmText: obj.confirmText,
showCancel: obj.showCancel,
cancelText: obj.cancelText,
success: (res) => {
obj.success ? obj.success(res) : () => {
};
resolve(res);
},
fail: (err) => {
obj.fail ? obj.fail(err) : () => {
};
reject(err);
},
complete: (res) => {
}
});
});
},
/**
* 上传文件
* @param {Object} obj
* @param {String} obj.mode img图片 video视频
*/
upload(obj) {
return new Promise((resolve, reject) => {
let token = uni.getStorageSync("token") || "";
obj.url = obj.url ? obj.url : "/file/upload";
obj.file = obj.file ? obj.file : "";
obj.data = obj.data ? obj.data : {};
obj.header = {
// 'Content-Type': 'multipart/form-data; ',
// 'Content-Type': 'application/json;charset=UTF-8',
"Access-Control-Allow-Origin": "*",
...obj.header
};
if (token)
obj.header["Authorization"] = `Bearer ${token}`;
uni.showLoading({
title: "正在上传"
});
uni.uploadFile({
url: util.config.host + obj.url,
filePath: obj.file,
header: obj.header,
formData: obj.data,
dataType: "json",
name: "file",
success: (res) => {
uni.hideLoading();
obj.success ? obj.success(JSON.parse(res.data)) : "";
resolve(JSON.parse(res.data));
},
fail: (res) => {
uni.hideLoading();
obj.fail ? obj.fail(res.data) : "";
reject(res);
}
});
});
},
/**
* 发送网络请求
* @param {Object} params 传参
* @param {String} params.url 请求地址 一般用于后台请求接口
* @param {Array} params.query 请求地址拼接参数 用于后台请求地址拼接补全
* @param {String} params.fullurl 全请求地址 一般用于第三方请求地址
* @param {Boolean} params.load 是否显示加载动画 默认不显示
* @param {Object} params.data 请求入参 没有则不传
* @param {Object} params.header 请求头 默认不传
* @param {String} params.method 请求方式 默认值POST
* @param {Function} params.success 请求成功回调 可通过promise.then捕获
* @param {Function} params.fail 请求失败回调 可通过promise.catch捕获
* @param {Function} params.complete 请求结束回调 无论是否成功失败都会执行
* @return {Object} 返回promis对象 执行成功返回resolve 执行失败返回reject
*/
request(params2) {
let token = uni.getStorageSync("token") || "";
return new Promise((resolve, reject) => {
let url = util.config.host + (params2.url ? params2.url : "/api/index/index");
if (params2.path && params2.path instanceof Array)
params2.path.forEach((item) => {
url += `/${item}`;
});
if (params2.query) {
url = util.setUrl(url, params2.query);
}
if (params2.load) {
uni.showLoading({
title: "加载中",
mask: true
});
}
params2.header = {
"Content-Type": "application/json;charset=UTF-8",
"Access-Control-Allow-Headers": "Origin, X-Requested-With, Content-Type, Accept",
// token: uni.getStorageSync('token'),
"Access-Control-Allow-Origin": "*",
"IS_APP_REQ": "APP_REQ",
...params2.header
};
if (token)
params2.header["Authorization"] = `Bearer ${token}`;
uni.request({
// 请求地址
url,
// 请求方式 get/post
method: params2.method ? params2.method : "POST",
// 是否开启SSL验证
sslVerify: false,
// 请求参数
data: params2.data,
// header请求头
header: params2.header,
// 数据类型
dataType: "json",
responseType: params2.responseType || "text",
// 请求成功返回
success: (res) => {
if (params2.load) {
uni.hideLoading();
}
if (res.data.code == 401) {
util.logout(() => {
util.alert("请先登录");
reject(res.data);
});
}
params2.success ? params2.success(res.data) : "";
resolve(res.data);
},
// 请求失败返回
fail: (res) => {
if (params2.load) {
uni.hideLoading();
}
params2.fail ? params2.fail(res) : "";
reject(res);
},
complete(res) {
params2.complete ? params2.complete(res) : "";
}
});
});
},
// 替换图片的宽度为最大宽度100% (移动端解析html富文本专用)
imgReplace(value, th) {
if (!th) {
value = value.replace(/<img src="/ig, '<img src="' + util.config.host);
}
return value.replace(/<p([\s\w"=\/\.:;]+)((?:(style="[^"]+")))/ig, "<p").replace(/<p>/ig, '<p style="font-size: 15px; line-height: 25px;">').replace(/<img([\s\w"-=\/\.:;]+)((?:(height="[^"]+")))/ig, "<img$1").replace(/<img([\s\w"-=\/\.:;]+)((?:(width="[^"]+")))/ig, "<img$1").replace(/<img([\s\w"-=\/\.:;]+)((?:(style="[^"]+")))/ig, "<img$1").replace(/<img([\s\w"-=\/\.:;]+)((?:(alt="[^"]+")))/ig, "<img$1").replace(/<img([\s\w"-=\/\.:;]+)/ig, '<img style="width: 100%;" $1');
},
/**
* 路由跳转方法
* @param {string} url 跳转的目标页面路径
* @param {Object} params 要传递的参数对象
* @param {string} method 跳转方法,默认为 navigateTo
*/
routeWithParams(url, params2 = {}, method = "navigateTo") {
const fullUrl = util.setUrl("url", params2);
switch (method) {
case "navigateTo":
uni.navigateTo({
url: fullUrl
});
break;
case "redirectTo":
uni.redirectTo({
url: fullUrl
});
break;
case "reLaunch":
uni.reLaunch({
url: fullUrl
});
break;
case "switchTab":
uni.switchTab({
url: fullUrl
});
break;
default:
throw new Error(`Unsupported method: ${method}`);
}
},
/**
* get参数拼接
* @param {Object} data 需要转化的对象
*/
set_param(data) {
let url = "";
if (!data)
data = [];
for (let [key, value] of Object.entries(data)) {
url += `${key}=${value}&`;
}
url = url.substring(url.length - 1) == "&" ? url.substring(0, url.length - 1) : url;
return url ? url : url.substring(1);
},
/**
* get参数拼接url
* @param {String} url 需要处理的url
* @param {Object} data 需要转化的Object对象
*/
setUrl(url, data) {
let result = url += (url.indexOf("?") < 0 ? "?" : "&") + util.set_param(data);
return result;
},
/**
* query字符串转对象
* @param {Object} str query字符串
*/
query_to_param(str) {
let obj = {};
decodeURIComponent(str).split("&").forEach((item) => {
let [key, val] = item.split("=");
obj[key] = val;
});
return obj;
},
/**
* 倒计时
* @param {String} endtime 结束时间
*/
countDownd(endtime) {
if (!endtime) {
return;
}
endtime = Number(endtime);
let day = util.timeFormin(parseInt(time / (60 * 60 * 24)));
let hou = util.timeFormin(parseInt(time % (60 * 60 * 24) / 3600));
let min = util.timeFormin(parseInt(time % (60 * 60 * 24) % 3600 / 60));
let sec = util.timeFormin(parseInt(time % (60 * 60 * 24) % 3600 % 60));
let str = "";
if (day) {
str += day + "天";
}
if (hou || hou == 0) {
if (hou > 9) {
str += hou + ":";
} else {
str += "0" + hou + ":";
}
} else {
str += "00:";
}
if (min || min == 0) {
if (min > 9) {
str += min + ":";
} else {
str += "0" + min + ":";
}
} else {
str += "00:";
}
if (sec) {
if (sec > 9) {
str += sec;
} else {
str += "0" + sec;
}
} else {
str += "00";
}
return str;
},
// 格式化时间
timeFormin(param) {
return param < 0 ? 0 : param;
},
/**
* 对二补齐
* @param {String} str 数字或数字字符串
*/
toTwo(str) {
let num = String(Number(str));
if (num.length < 2) {
num = "0" + num;
}
return num;
},
/**
* 时间戳处理成时间
* @param {Object} str
* 时间格式 月、日、时、分、秒 单个字母不补0
* yyyy 年
* MM 月
* dd 日
* WW 周
* HH 小时 24小时制
* hh 小时 12小时制
* mm 分钟
* ss 秒
* a am/pm
* 比如 'yyyy-MM-dd HH:mm:ss 周w a' 返回2023-02-06 11:19:19 周一 pm
* @param {Number} timestamp 需要处理时间戳
*/
formatTime(str, timestamp) {
const nowDate = /* @__PURE__ */ new Date();
let weekList = ["日", "一", "二", "三", "四", "五", "六"];
if (!str || typeof str != "string") {
str = "yyyy-MM-dd HH:mm:ss";
}
if (!timestamp) {
timestamp = nowDate.valueOf();
} else if (String(timestamp).length <= 10) {
timestamp = timestamp * 1e3;
}
const date = new Date(timestamp);
let year = date.getFullYear(), moth = date.getMonth() + 1, day = date.getDate(), week = date.getDay(), hour = date.getHours(), minute = date.getMinutes(), second = date.getSeconds();
str = str.replace("yyyy", year);
str = str.replace("MM", this.toTwo(moth));
str = str.replace("M", moth);
str = str.replace("dd", this.toTwo(day));
str = str.replace("d", day);
str = str.replace("w", weekList[week]);
if (str.match("h")) {
hour = hour > 12 ? hour - 12 : hour;
str = str.replace("hh", this.toTwo(hour));
str = str.replace("h", hour);
} else if (str.match("H")) {
str = str.replace("HH", this.toTwo(hour));
str = str.replace("H", hour);
}
str = str.replace("mm", this.toTwo(minute));
str = str.replace("m", minute);
str = str.replace("ss", this.toTwo(second));
str = str.replace("s", second);
let a = hour > 12 ? "am" : "pm";
str = str.replace("a", a);
return str;
},
/**
* 时间计算
* @param {String} format 格式化 规则
* format '+1 month' 往后一个月
* @param {Number} value 需要处理的时间戳 单位秒
*/
strtotime(format, value) {
if (value && format.indexOf(" ") > -1) {
let unit = format.split(" ");
let pre = unit[0];
let next = unit[1];
if (!value)
value = nowDate2.valueOf();
else if (String(value).length <= 10)
value = value * 1e3;
let nowDate2 = new Date(value);
switch (next) {
case "year":
nowDate2.setYear(nowDate2.getFullYear() + parseInt(pre));
break;
case "month":
nowDate2.setMonth(nowDate2.getMonth() + parseInt(pre));
break;
case "day":
nowDate2.setDate(nowDate2.getDate() + parseInt(pre));
break;
case "week":
nowDate2.setDate(nowDate2.getDate() + parseInt(pre) * 7);
break;
case "hour":
nowDate2.setHours(nowDate2.getHours() + parseInt(pre));
break;
case "minute":
nowDate2.setMinutes(nowDate2.getMinutes() + parseInt(pre));
break;
}
return nowDate2.getTime();
} else {
var nowDate = new Date(value);
return nowDate.getTime();
}
},
/**
* 上传图片
* @param {Object} obj 对象类型
* @param {Array} obj.value 操作的对象
* @param {Boolean} obj.unlimited 不限制
* @param {Number} obj.count 图片计数
* @param {Number} obj.type 1单张 2多张
* @param {Array} obj.sourceType ['album', 'camera']
* @param {Function} obj.success 执行成功返回的方法return修改的对象
*/
upload_image(obj) {
const count = obj.count ? obj.count : 8;
if (!obj.type)
obj.type = 2;
if (obj.value != "" && obj.value == void 0 && obj.value == null)
obj.value = obj.type == 1 ? "" : [];
if (obj.value.length >= count && obj.type == 2) {
util.alert("上传图片已达上限");
return;
}
let sourceType = ["album", "camera"];
uni.chooseImage({
// 限制图片
count: obj.type == 1 ? 1 : count - obj.value.length,
sourceType: obj.sourceType || sourceType,
success: (rs) => {
rs.tempFiles.forEach((item) => {
let size = 1024 * 1024 * util.config.img_size;
if (item.size > size && !obj.unlimited) {
util.alert(`大小超过${util.config.img_size}m`);
return;
}
util.upload({
file: item.path,
mode: "img",
success(res) {
if (res.code === 200) {
const result = res.data.url;
if (obj.type == 2) {
obj.value.push(result);
} else if (obj.type == 1) {
obj.value = result;
}
obj.success && obj.success({
value: result
});
return;
}
util.alert(rs.msg);
}
});
});
},
fail(rs) {
if (rs.errMsg == "chooseImage:fail cancel")
;
}
});
},
/**
* 上传视频
* @param {Object} obj 对象类型
* @param {Array} obj.value 操作的对象
* @param {Object} obj.unlimited 不限制
* @param {Object} obj.count 计数
* @param {Object} obj.success 执行成功返回的方法return修改的对象
*/
upload_video(obj) {
obj.count ? obj.count : 1;
uni.chooseVideo({
compressed: false,
success(rs) {
util.upload({
file: rs.tempFilePath,
mode: "video",
success(res) {
if (res.code == 200) {
obj.success && obj.success({
value: res.data.url,
width: rs.width,
height: rs.height,
size: rs.size,
duration: rs.duration
// value: fullUrl,
});
return;
} else {
util.alert(res.msg);
}
}
});
},
fail(rs) {
if (rs.errMsg == "chooseImage:fail cancel")
;
}
});
},
/**
* 上传文件
* @param {Object} obj 对象类型
* @param {Array} obj.value 操作的对象
* @param {Object} obj.count 计数
* @param {Object} obj.success 执行成功返回的方法return修改的对象
*/
upload_files(obj) {
const value = obj.value;
const file_suffix = util.config.file_suffix;
const count = obj.count ? obj.count : 1;
if (value.length >= count) {
util.alert("上传数量已达上限");
return;
}
formatAppLog("log", "at common/js/util.js:719", "upload_files", obj);
function result_fn(path) {
let str = path.split(".").pop().toLowerCase();
let reult = file_suffix.find((node) => node.id == str);
if (!reult) {
util.alert(`不能上传${str}格式文件`);
return;
}
util.upload({
file: path,
success(res) {
if (res.code == 200) {
value.push(res.data);
obj.success && obj.success({
...res.data,
value
});
} else {
util.alert(res.msg);
}
}
});
}
if (uni.getSystemInfoSync().platform == "android") {
formatAppLog("log", "at common/js/util.js:771", "chooseFile");
chooseFile((rs) => {
formatAppLog("log", "at common/js/util.js:773", "rs", rs);
result_fn(rs);
});
} else {
util.alert("因权限问题暂不支持非android平台");
}
return;
},
/**
* 上传音频
* @param {Object} obj 对象类型
* @param {Array} obj.value 操作的对象
* @param {Object} obj.count 计数
* @param {Object} obj.success 执行成功返回的方法return修改的对象
*/
upload_audio(obj) {
const value = obj.value;
const audio_suffix = util.config.audio_suffix;
const count = obj.count ? obj.count : 1;
if (value.length >= count) {
util.alert("上传数量已达上限");
return;
}
function result_fn(path) {
let str = path.split(".").pop().toLowerCase();
let reult = audio_suffix.find((node) => node.id == str);
if (!reult) {
util.alert(`不能上传${str}格式文件`);
return;
}
util.upload({
file: path,
success(res) {
if (res.code == 200) {
value.push(res.data);
obj.success && obj.success({
...res.data,
value
});
} else {
util.alert(res.msg);
}
}
});
}
if (uni.getSystemInfoSync().platform == "android") {
chooseFile((rs) => {
formatAppLog("log", "at common/js/util.js:856", "chooseFile", rs);
result_fn(rs);
});
} else {
util.alert("因权限问题暂不支持非android平台");
}
return;
},
/**
* 视频转封面 oss特有
* @param {Object} url 视频路径
*/
video_coverImage(url) {
let result = `${url}?x-oss-process=video/snapshot,t_1,m_fast`;
return result;
},
/**
* 预览图片
* @param {Array} urls 图片列表
* @param {Number} current 当前预览的下标
*/
view_imgs(urls, current) {
if (!urls || urls.length == 0) {
util.alert("暂无");
return;
}
uni.previewImage({
urls,
current
});
},
/**
* 预览文件
* @param {String} url 文件路径
*/
view_file(url) {
let suffix = util.get_file_suffix(url).id;
if (!["doc", "xls", "ppt", "pdf", "docx", "xlsx", "pptx"].includes(suffix)) {
util.alert("操作需要在web端");
formatAppLog("log", "at common/js/util.js:903", "Unsupported suffix", suffix);
return;
}
uni.downloadFile({
url,
success: (res) => {
uni.openDocument({
filePath: res.tempFilePath,
fail: (rs) => {
formatAppLog("log", "at common/js/util.js:912", "rs", rs);
}
});
}
});
},
/**
* 通过路径获取文件后缀
* @param {Object} url 需要获取的文件路径
* @param {Object} type file文件 audio音频
* @return {Object} 返回后缀列表对象 util.config.file_suffix
*/
get_file_suffix(url, type) {
if (!type)
type = "file";
const file_suffix = util.config[{
"file": "file_suffix",
"audio": "audio_suffix"
}[type]];
let result = "";
if (url)
result = file_suffix.find((item) => item.id === url.split(".").pop().toLowerCase());
return result;
},
/**
* 通过路径获取音频后缀
* @param {Object} url 需要获取的文件路径
* @return {Object} 返回后缀列表对象 util.config.file_suffix
*/
get_audio_suffix(url) {
const audio_suffix = util.config.audio_suffix;
let result = "";
if (url)
result = audio_suffix.find((item) => item.id === url.split(".").pop().toLowerCase());
return result;
},
/**
* 调起支付
* @param {Object} obj 操作对象
* @param {String} obj.payType 支付方式 WeChat微信 AliPay支付宝 4钱包
* @param {String} obj.method 支付环境 app手机应用 mp小程序
* @param {String} obj.debug 调试模式
* @param {Boolean|Object} obj.cb 支付结果跳转 false为不跳转 跳转需携带object定义对象
* @param {String} obj.cb.styles 风格 style1蓝色 style2绿色 style3橙色
* @param {String} obj.cb.result 结果 success成功 fail失败
* @param {String} obj.cb.price 价格
* @param {String} obj.cb.url 跳转的详情路径
* @param {Function} obj.fn 请求接口函数
* @param {Function} obj.success 成功方法
* @param {Function} obj.fail 失败方法
* @param {Function} obj.complete 结束方法
*/
payment(obj) {
obj = obj ? obj : {};
obj.data = obj.data ? obj.data : {};
obj.method = "app";
util.payment_request(obj);
},
// 支付请求
payment_request(obj) {
obj.debug ? formatAppLog("log", "at common/js/util.js:993", "params", obj) : "";
if (!obj.fn) {
throw "no function";
}
function result_goto(result) {
const cb = obj.cb;
if (!cb)
return;
uni.redirectTo({
url: util.setUrl("/index/pay_result", {
orderNumber: cb.orderNumbers || "",
result,
styles: cb.styles || "",
price: cb.price || "",
url: cb.url || ""
})
});
}
obj.fn(obj.data).then((rs) => {
obj.debug ? formatAppLog("log", "at common/js/util.js:1022", "request success result", rs) : "";
if (rs.code == 200) {
switch (obj.data.payType) {
case "1":
switch (obj.method) {
case "mp":
if (rs.data && rs.data.paySign) {
uni.requestPayment({
provider: "wxpay",
timeStamp: rs.data.timeStamp,
package: rs.data.package,
nonceStr: rs.data.nonceStr,
paySign: rs.data.paySign,
signType: rs.data.signType,
success(result) {
obj.success ? obj.success(rs) : "";
result_goto("success");
},
fail(result) {
obj.fail ? obj.fail(result) : "";
result_goto("fail");
},
complete(result) {
obj.debug ? formatAppLog(
"log",
"at common/js/util.js:1048",
"requestPayment complete",
result
) : "";
obj.complete ? obj.complete(result) : "";
}
});
} else {
obj.fail ? obj.fail("no data") : "";
}
break;
case "app":
uni.requestPayment({
provider: "wxpay",
orderInfo: rs.data,
success(result) {
obj.success ? obj.success(rs) : "";
result_goto("success");
},
fail(result) {
obj.fail ? obj.fail(result) : "";
result_goto("fail");
},
complete(result) {
obj.debug ? formatAppLog("log", "at common/js/util.js:1071", "requestPayment complete", result) : "";
obj.complete ? obj.complete(result) : "";
}
});
break;
}
break;
case "2":
switch (obj.method) {
case "app":
uni.requestPayment({
provider: "alipay",
orderInfo: rs.msg,
success(result) {
obj.success ? obj.success(rs) : "";
result_goto("success");
},
fail(result) {
obj.fail ? obj.fail(result) : "";
result_goto("fail");
},
complete(result) {
obj.debug ? formatAppLog("log", "at common/js/util.js:1096", "requestPayment complete", result) : "";
obj.complete ? obj.complete(result) : "";
}
});
break;
}
break;
case "4":
obj.success ? obj.success(rs) : "";
result_goto("success");
break;
}
} else {
util.alert(rs.msg);
obj.fail ? obj.fail(rs) : "";
}
}).catch((rs) => {
formatAppLog("log", "at common/js/util.js:1116", "request catch result", rs);
});
},
// 微信小程序登录
weChatLogin(obj) {
obj = obj ? obj : {};
const parent_id = uni.getStorageSync("parent_id");
const admin_id = uni.getStorageSync("admin_id");
uni.getUserProfile({
desc: "weixin",
success: (e) => {
const userInfo = e.userInfo;
let data = {
nickName: userInfo.nickName,
avatarUrl: userInfo.avatarUrl
};
uni.login({
provider: "weixin",
success: (rs) => {
data.code = rs.code;
data.platform = "wechatMini";
if (parent_id)
data.parent_id = parent_id;
if (admin_id)
data.admin_id = admin_id;
if (rs.errMsg == "login:ok") {
util.request({
url: "/api/user/third",
data,
load: 1
}).then((res) => {
if (res.code == 200) {
obj.success ? obj.success(res) : "";
}
});
}
}
});
},
fail(res) {
util.alert("您拒绝了授权");
obj.fail ? obj.fail(res) : (res2) => {
};
},
complete() {
obj.complete ? obj.complete() : "";
}
});
},
/**
* 拉起授权请求: 微信小程序、app
*/
authorize(obj) {
return new Promise((resolve, reject) => {
obj ? obj : obj = {};
let isAgreePrivacy = plus.runtime.isAgreePrivacy();
if (!isAgreePrivacy) {
resolve("未同意用户协议隐私政策");
return;
}
const menu = {
// 定位
location: {
name: "定位服务",
scope: "scope.userLocation",
txt: "需要获取您的地理位置"
},
// 相册
photosAlbum: {
name: "相册",
scope: "scope.writePhotosAlbum",
txt: "需要访问您的相册"
},
// 相机
camera: {
name: "摄像头",
scope: "scope.camera",
txt: "需要访问您的摄像头"
}
};
if (obj.key) {
obj = {
...obj,
...menu[obj.key]
};
}
let fnName = "";
fnName = "appAuthorize";
this[fnName](obj).then((rs) => {
obj.success ? obj.success(rs) : "";
resolve(rs);
}).catch((err) => {
obj.fail ? obj.fail(err) : "";
reject(err);
});
});
},
// app授权
appAuthorize(obj) {
return new Promise((resolve, reject) => {
const systemSetting = uni.getSystemSetting();
if (systemSetting.locationEnabled === false) {
this.alert(obj.txt);
reject({
msg: "未授权对应功能"
});
return;
}
const authorized = uni.getAppAuthorizeSetting().locationAuthorized;
formatAppLog("log", "at common/js/util.js:1278", "locationAuthorized", authorized);
if (authorized === "config error") {
reject({
msg: "开发者未勾选定位服务模块"
});
return;
} else if (authorized === "denied")
;
else if (authorized === "authorized") {
resolve(obj);
return;
}
if (uni.getSystemInfoSync().platform == "android") {
plus.android.requestPermissions(
// 对应权限
["android.permission.ACCESS_FINE_LOCATION"],
// 成功
(resultObj) => {
let result = null;
for (let i = 0; i < resultObj.granted.length; i++) {
let grantedPermission = resultObj.granted[i];
formatAppLog("log", "at common/js/util.js:1310", "已获取的权限:" + grantedPermission);
}
for (let i = 0; i < resultObj.deniedPresent.length; i++) {
let deniedPresentPermission = resultObj.deniedPresent[i];
formatAppLog("log", "at common/js/util.js:1317", "拒绝本次申请的权限:" + deniedPresentPermission);
}
for (let i = 0; i < resultObj.deniedAlways.length; i++) {
let deniedAlwaysPermission = resultObj.deniedAlways[i];
formatAppLog("log", "at common/js/util.js:1323", "永久拒绝申请的权限:" + deniedAlwaysPermission);
}
if ([-1].includes(result)) {
uni.openAppAuthorizeSetting({
success: (rs) => {
reject({
msg: "引导用户打开设置页面",
info: rs
});
},
fail: (err) => {
reject({
msg: "用户设置页面打开失败",
info: err
});
}
});
}
},
// 失败
(error) => {
formatAppLog("log", "at common/js/util.js:1353", "申请权限错误:" + error.code + " = " + error.message);
resolve({
code: error.code,
message: error.message
});
}
);
} else {
this.alert("请在设置里允许打开定位信息");
resolve({
msg: "用户未开启定位权限"
});
return;
}
});
},
// 微信小程序授权
weChatAuthorize(obj) {
return new Promise((resolve, reject) => {
if (![
"scope.userInfo",
"scope.userLocation",
"scope.userLocationBackground",
"scope.address",
"scope.record",
"scope.writePhotosAlbum",
"scope.camera",
"scope.invoice",
"scope.invoiceTitle",
"scope.werun"
].includes(obj.scope)) {
resolve({
msg: "不在限制范围内"
});
return;
}
uni.authorize({
scope: obj.scope,
success: (rs) => {
resolve(rs);
},
fail: (err) => {
reject(err);
util.alert({
title: "系统提示",
value: obj.txt,
success: (rs) => {
if (rs.confirm) {
uni.openSetting();
}
}
});
}
});
});
},
/**
* 最终登录 用于请求登录接口后统一调用的登录方法
* @param {Object} param 数据对象
* @param {Function} cb 回调函数
*/
finalLogin(param, cb) {
const token = param.data;
uni.setStorageSync("token", token);
uni.showLoading({
mask: true
});
util.getUserinfo((userinfo) => {
uni.$emit("login");
util.loginTencent(userinfo);
setTimeout(() => {
uni.switchTab({
url: "/pages/index/index"
});
}, 500);
cb ? cb() : "";
});
},
// 登录账号管理
loginAccountManagement(userInfo) {
let userList = uni.getStorageSync("userInfoList") || [];
const index = userList.findIndex((item) => item.userId === userInfo.userId);
if (index !== -1) {
userList.splice(index, 1);
}
userList.push(userInfo);
uni.setStorageSync("userInfoList", userList);
},
// 登录腾讯聊天
loginTencent(userinfo) {
api.login.getIMToken({}).then((rs) => {
const loginParams = {
SDKAppID: util.config.TChat.SDKAppID,
userID: userinfo.id + "",
userSig: rs.msg
};
uni.$TUICallKit.login(loginParams, (res) => {
if (res.code === 0) {
formatAppLog("log", "at common/js/util.js:1476", "[TUICallKit] login success.");
} else {
formatAppLog("error", "at common/js/util.js:1478", "[TUICallKit] login failed, failed message = ", res.msg, params);
}
});
uni.$chat.login({
userID: userinfo.id + "",
userSig: rs.msg
}).then((rs2) => {
formatAppLog("log", "at common/js/util.js:1487", "im login success", rs2);
});
});
return;
},
/**
* 获取用户信息
* @param {Function} cb 回调函数
*/
getUserinfo(cb) {
return new Promise((reslove) => {
api.mine.getUserinfo().then((rs) => {
if (rs.code === 200) {
const userinfo = rs.data;
reslove(userinfo);
store.commit("setState", {
key: "userinfo",
value: userinfo
});
uni.setStorageSync("userinfo", userinfo);
cb ? cb(userinfo) : "";
}
}).finally(() => {
uni.hideLoading();
});
});
},
/**
* 验证登录
* @param {Object} cb 回调函数
*/
isLogin(cb) {
let userinfo = uni.$store.state.userinfo;
return new Promise((resolve, reject) => {
if (!userinfo.id) {
reject();
return;
}
resolve();
cb ? cb() : "";
});
},
/**
* 清除登录状态
* @param {Function} cb 回调函数
*/
logout(cb) {
const userinfo = store.state.userinfo;
if (userinfo.userId) {
uni.$emit("logout");
uni.$chat.logout().then((rs) => {
formatAppLog("log", "at common/js/util.js:1562", "tim logout rs");
}).catch((rs) => {
formatAppLog("log", "at common/js/util.js:1564", "tim logout error:", rs);
});
}
store.commit("setState", {
key: "userinfo",
value: {}
});
uni.removeStorageSync("userinfo");
uni.removeStorageSync("token");
cb ? cb() : "";
},
// 是否实名
isAuth(param) {
util.isLogin(() => {
const userinfo = uni.$store.state.userinfo;
formatAppLog("log", "at common/js/util.js:1586", "userinfo.userIdCard", userinfo.userIdCard);
if (userinfo.userIdCard) {
param.success ? param.success(userinfo) : "";
return;
}
if (!param.noLink)
uni.navigateTo({
url: "/pages/mine/realname"
});
param.fail ? pararm.fail(userinfo) : "";
});
},
// 拨打电话
makePhone(phoneNumber) {
if (!phoneNumber) {
util.alert("暂无手机号");
}
uni.makePhoneCall({
phoneNumber,
fail(err) {
formatAppLog("log", "at common/js/util.js:1608", "err", err);
}
});
},
/**
* 处理路径添加host或这默认图片地址
* @param {String} ev 需要处理的字符串
* @param {String} mode img图片 video视频
* @return {String} 返回的路径
*/
format_url(ev, mode) {
if (!ev)
return "";
if (ev.match(/^http/))
return ev;
return "https://9yvideo.oss-cn-beijing.aliyuncs.com/" + ev;
},
/**
* 去除路径里的host
* @param {Object} ev 需要处理的字符串
* @return {String} 处理之后的路径
*/
replace_url(ev) {
if (!ev || typeof ev != "string")
throw `${ev} is not String`;
let result = ev.slice(ev.indexOf("/images") + 1);
return result;
},
/**
* 格式化经纬度
* @param {String} num 数字或数字字符串
*/
formart_lnglat(num) {
if (!num)
return num;
num = parseFloat(Number(num).toFixed(6));
return num;
},
/**
* 检查跳转
* @param {String} route 路径
* @param {String} type 跳转
*/
checkLink(route, type = "navigateTo") {
const currentPages = getCurrentPages();
const find_route = route;
const find_index = currentPages.findIndex((node) => {
return node.route == find_route;
});
if (find_index < 0) {
uni[type]({
url: `/${find_route}`
});
} else {
uni.navigateBack({
delta: currentPages.length - find_index - 1
});
}
},
/**
* 数字转化
*/
rp(n) {
var cnum = ["零", "一", "二", "三", "四", "五", "六", "七", "八", "九", "十"];
var s = "";
n = "" + n;
for (var i = 0; i < n.length; i++) {
s += cnum[parseInt(n.charAt(i))];
}
if (s.length == 2) {
if (s.charAt(1) == cnum[0]) {
s = s.charAt(0) + cnum[10];
if (s == cnum[1] + cnum[10]) {
s = cnum[10];
}
} else if (s.charAt(0) == cnum[1]) {
s = cnum[10] + s.charAt(1);
} else if (s.charAt(0) == cnum[2]) {
s = cnum[2] + cnum[10] + s.charAt(1);
} else if (s.charAt(0) == cnum[3]) {
s = cnum[3] + cnum[10] + s.charAt(1);
} else if (s.charAt(0) == cnum[4]) {
s = cnum[4] + cnum[10] + s.charAt(1);
} else if (s.charAt(0) == cnum[5]) {
s = cnum[5] + cnum[10] + s.charAt(1);
} else if (s.charAt(0) == cnum[6]) {
s = cnum[6] + cnum[10] + s.charAt(1);
} else if (s.charAt(0) == cnum[7]) {
s = cnum[7] + cnum[10] + s.charAt(1);
} else if (s.charAt(0) == cnum[8]) {
s = cnum[8] + cnum[10] + s.charAt(1);
} else if (s.charAt(0) == cnum[9]) {
s = cnum[9] + cnum[10] + s.charAt(1);
} else if (s.charAt(0) == cnum[10]) {
s = cnum[10] + cnum[10] + s.charAt(1);
}
}
return s;
},
/**
* 复制文本
* @param {String} text 需要复制的文本
*/
copyText(text) {
uni.setClipboardData({
data: text,
success: () => {
util.alert({
title: "文本已复制到剪贴板"
});
}
});
},
showToastAndRedirect(title, icon = "none", fun = () => {
}) {
uni.showToast({
title,
icon,
duration: 2e3,
// 显示两秒
complete: () => {
fun();
uni.hideLoading();
}
});
},
/**
* 去聊天
* @param {Object} option
* @param {Object} option.name 标题昵称
* @param {Object} option.msgId 聊天对象id
* @param {Object} option.type 聊天类型
*/
toChat(option) {
uni.navigateTo({
url: util.setUrl("/pages/news/chat/chat", {
name: option.name,
msgId: option.msgId,
type: option.type
})
});
},
// 扫码
scan() {
uni.scanCode({
success: (res) => {
if (res && res.result) {
let result = JSON.parse(res.result);
if (result.key == "user") {
uni.navigateTo({
url: util.setUrl("/pages/news/applyFriend", {
userId: result.userId,
nickname: result.userNickname
})
});
}
}
},
fail: (err) => {
util.alert("二维码扫描失败");
}
});
},
// 获取我的钱包
getPurse() {
api.mine.selectPurse().then((rs) => {
if (rs.code == 200) {
uni.$store.commit("setState", {
key: "purse",
value: rs.data
});
return;
}
util.alert({
content: rs.msg,
showCancel: false
});
});
},
// 获取我的任务
getMyTask() {
util.isLogin().then(() => {
api.intergral.viewingTasks({}).then((rs) => {
if (rs.code == 200) {
uni.$store.commit("setState", {
key: "task",
value: rs.data
});
return;
}
});
}).catch(() => {
uni.$store.commit("setState", {
key: "task",
value: {
//任务类型 0.任务读秒 1.流量点(种子)读秒
taskType: 0,
//有效时长
viewingDuration: 0
}
});
});
}
};
const util$1 = util;
const _style_0$8 = {};
const _sfc_main$9 = {
__name: "statusBar",
setup(__props, { expose: __expose }) {
__expose();
const height = ref(0);
onLoad(() => {
uni.getSystemInfo().then((rs) => {
height.value = rs.statusBarHeight + "px";
});
});
const __returned__ = { height, get onLoad() {
return onLoad;
}, ref };
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
return __returned__;
}
};
function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
return openBlock(), createElementBlock(
"view",
{
style: normalizeStyle({ height: $setup.height }),
renderWhole: true
},
null,
4
/* STYLE */
);
}
const statusBar = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["render", _sfc_render$9], ["styles", [_style_0$8]], ["__file", "D:/document/九亿商城/jy/jiuyi2/components/header/statusBar.vue"]]);
const _style_0$7 = { "timeBox": { "": { "position": "fixed", "left": 0, "right": 0, "bottom": "300rpx", "textAlign": "center", "zIndex": 9 } }, "time": { ".timeBox ": { "width": "450rpx", "paddingTop": 0, "paddingRight": "20rpx", "paddingBottom": 0, "paddingLeft": "20rpx", "backgroundColor": "rgba(0,0,0,0.6)", "borderRadius": "10rpx" } }, "text": { ".timeBox ": { "marginTop": "10rpx", "marginRight": "20rpx", "marginBottom": "10rpx", "marginLeft": "20rpx", "fontSize": "50rpx", "color": "#ffffff" } }, "durationBox": { "": { "paddingTop": "60rpx" } }, "duration": { ".durationBox ": { "width": "750rpx", "backgroundColor": "rgba(255,255,255,0.3)" } }, "line": { ".durationBox .duration ": { "width": 0, "height": "2rpx", "backgroundColor": "rgba(255,255,255,0.8)", "transitionDuration": 250 } }, "@TRANSITION": { "line": { "duration": 250 } } };
const _sfc_main$8 = {
__name: "videoProgress",
props: {
time: {
type: Object,
default: {
duration: 0,
currentTime: 0
}
},
// 组件宽度
viewWidth: {
type: Number
}
},
emits: ["change", "end"],
setup(__props, { expose: __expose, emit: __emit }) {
__expose();
const props = __props;
watch(props.time, (nV, oV) => {
formatAppLog("log", "at components/index/videoProgress.vue:29", "time", nV, oV);
}, {
deep: true
});
const emit = __emit;
const {
proxy
} = getCurrentInstance();
const trigger = ref(false);
const videoTime = ref(0);
const videoProgress2 = ref(0);
const videoCurrent = computed(() => {
let result = formatNum(props.time.currentTime);
if (trigger.value)
result = videoTime.value;
return result;
});
const progress = computed(() => {
let result = 0;
if (!trigger.value) {
const duration = formatNum(props.time.duration);
if (duration != 0)
result = formatNum(props.time.currentTime) / duration * props.viewWidth;
result = formatNum(result);
} else {
result = videoProgress2.value;
}
return result;
});
const formatDuration = computed(() => {
let result = formatNum(props.time.duration).toFixed(2);
return result;
});
function formatNum(num) {
let result = Number.parseFloat(num).toFixed(2);
return Number.parseFloat(result);
}
function onStart() {
trigger.value = true;
}
function onMove(ev) {
const time2 = formatNum(ev.changedTouches[0].screenX);
let target = formatNum(formatNum(time2 / props.viewWidth) * Number(formatDuration.value));
videoTime.value = target;
videoProgress2.value = time2;
}
function onEnd(ev) {
trigger.value = false;
emit("change", {
time: videoTime.value
});
}
const __returned__ = { props, emit, proxy, trigger, videoTime, videoProgress: videoProgress2, videoCurrent, progress, formatDuration, formatNum, onStart, onMove, onEnd, ref, computed, onMounted, getCurrentInstance, watch };
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
return __returned__;
}
};
function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
return openBlock(), createElementBlock(
Fragment,
null,
[
$setup.trigger ? (openBlock(), createElementBlock("view", {
key: 0,
class: "timeBox fdr jcc"
}, [
createElementVNode("view", { class: "time fdr jcc" }, [
createElementVNode(
"u-text",
{ class: "text f1" },
toDisplayString($setup.videoCurrent),
1
/* TEXT */
),
createElementVNode("u-text", { class: "text" }, "/"),
createElementVNode(
"u-text",
{ class: "text f1" },
toDisplayString($setup.formatDuration),
1
/* TEXT */
)
])
])) : createCommentVNode("v-if", true),
createElementVNode(
"view",
{
class: "durationBox",
ref: "durationBoxRef",
onTouchstart: withModifiers($setup.onStart, ["stop"]),
onTouchmove: withModifiers($setup.onMove, ["stop"]),
onTouchcancel: $setup.onEnd,
onTouchend: withModifiers($setup.onEnd, ["stop"])
},
[
createCommentVNode(' <slider :min="0" :max="formatDuration" @change="change" /> '),
createElementVNode("view", { class: "duration" }, [
createElementVNode(
"view",
{
class: "line",
style: normalizeStyle({ width: $setup.progress + "px" })
},
null,
4
/* STYLE */
)
])
],
544
/* NEED_HYDRATION, NEED_PATCH */
)
],
64
/* STABLE_FRAGMENT */
);
}
const videoProgress = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["render", _sfc_render$8], ["styles", [_style_0$7]], ["__file", "D:/document/九亿商城/jy/jiuyi2/components/index/videoProgress.vue"]]);
const _imports_0$2 = "/static/pause.png";
const _imports_1 = "/static/indexAtt.png";
const _imports_2 = "/static/indexLike.png";
const _imports_3 = "/static/indexLike1.png";
const _imports_4 = "/static/privateLike.png";
const _imports_5 = "/static/indexMsg.png";
const _imports_6 = "/static/indexCollect1.png";
const _imports_7 = "/static/indexCollect.png";
const _imports_8 = "/static/indexShare.png";
const _imports_9 = "/static/indexMoney1.png";
const _imports_10 = "/static/indexMoney.png";
const _style_0$6 = { "container": { "": { "backgroundColor": "#000000" } }, "duration": { "": { "marginTop": "120rpx", "width": "750rpx", "backgroundColor": "rgba(255,255,255,0.3)" } }, "line": { ".duration ": { "width": 0, "height": "2rpx", "backgroundColor": "rgba(255,255,255,0.8)", "transitionDuration": 250 } }, "speedBox": { "": { "position": "absolute", "top": "200rpx", "left": 0, "right": 0, "alignItems": "center" } }, "speed": { ".speedBox ": { "backgroundColor": "rgba(0,0,0,0.8)", "borderRadius": "5rpx", "opacity": 0.6 } }, "pausePanel": { "": { "backgroundColor": "rgba(0,0,0,0.5)" } }, "pauseImg": { ".pausePanel ": { "width": "140rpx", "height": "140rpx" } }, "panelRight": { "": { "alignItems": "flex-end" } }, "text": { ".panelRight ": { "textAlign": "center", "color": "#ffffff", "fontSize": "24rpx" } }, "operate": { ".panelRight ": { "flex": 1, "justifyContent": "flex-end", "alignItems": "flex-end", "textAlign": "center", "paddingBottom": "130rpx" } }, "item": { ".panelRight .operate ": { "marginTop": "5rpx", "marginRight": 0, "marginBottom": "5rpx", "marginLeft": 0, "paddingTop": "10rpx", "paddingRight": "5rpx", "paddingBottom": "10rpx", "paddingLeft": "5rpx" }, ".panelRight .operate .money": { "paddingTop": 0, "paddingRight": 0, "paddingBottom": 0, "paddingLeft": 0 } }, "col": { ".panelRight .operate .item ": { "alignItems": "center", "justifyContent": "center", "width": "80rpx" } }, "focus": { ".panelRight ": { "alignItems": "center", "left": 0, "right": 0, "bottom": 0 } }, "panelBottom": { "": { "paddingRight": "150rpx" } }, "goods": { ".panelBottom ": { "paddingTop": "10rpx", "paddingRight": "10rpx", "paddingBottom": "10rpx", "paddingLeft": "10rpx", "width": "480rpx", "marginBottom": "20rpx", "backgroundColor": "rgba(0,0,0,0.3)" } }, "videoProgress": { "": { "position": "absolute", "left": 0, "right": 0, "bottom": 0 } }, "@TRANSITION": { "line": { "duration": 250 } } };
const _sfc_main$7 = {
__name: "indexVideo",
props: {
// 当前视频对象
item: {
type: Object
},
// 列表中的视频下标
index: {
type: Number
},
// 当前列表的index
current: {
type: Number
},
// 当前tab的index
tabIndex: {
type: Number
},
// 模式 list列表 detail详情
mode: {
type: String,
default: "list"
},
// 是否我自己 0不是 1是
isMine: {
type: [String, Number],
default: 0
},
width: {
type: Number,
default: 0
},
height: {
type: Number,
default: 0
}
},
emits: [
"showTime",
"showComment",
"showCollect",
"showFastCollect",
"showShareFirend",
"onPlay",
"onPause",
"like",
"detailMenu",
"onEnd",
"longtap"
],
setup(__props, { expose: __expose, emit: __emit }) {
const {
proxy
} = getCurrentInstance();
const props = __props;
const emit = __emit;
const videoCtx = ref(null);
const playState = ref(true);
const collectFirst = ref(false);
const videoTime = ref({
// 总长
duration: 0,
// 当前时间
currentTime: 0
});
const tapList = reactive([]);
const tapTimer = ref(null);
const isTap = ref(false);
const isLong = ref(false);
const collectBtnActive = ref(false);
const alarmTime = computed(() => {
let result = uni.$store.state.alarmTime;
return result;
});
const fit = computed(() => {
const ratio1 = parseInt(props.width) / parseInt(props.height);
const ratio2 = props.item.breadth / props.item.height;
let result = "contain";
if (Math.abs(formatNumber(ratio2) - formatNumber(ratio1)) < 1)
result = "cover";
return result;
});
watch(() => props.current, (nV) => {
if (nV == props.index)
play();
else
pause();
});
onMounted(() => {
videoCtx.value = uni.createVideoContext(`video${props.tabIndex}${props.index}`);
});
function formatNumber(result) {
result = parseFloat(result) * 10;
return result;
}
function onTouchStart() {
if (isTap.value) {
return;
} else {
isTap.value = true;
let time2 = (/* @__PURE__ */ new Date()).getTime();
tapList.push(time2);
}
clearTimeout(tapTimer.value);
}
function onTouchEnd() {
if (isTap.value) {
isTap.value = false;
let time2 = (/* @__PURE__ */ new Date()).getTime();
let diff = time2 - tapList[tapList.length - 1];
if (diff > 350) {
if (isLong.value) {
isLong.value = false;
videoCtx.value.playbackRate(1);
}
tapList.length = 0;
return;
}
tapTimer.value = setTimeout(() => {
props.item.isLike;
let a = tapList.length;
tapList.length = 0;
switch (a) {
case 1:
changeVideoPlay();
break;
case 2:
formatAppLog("log", "at components/index/indexVideo.vue:176", "公开赞");
return;
case 3:
formatAppLog("log", "at components/index/indexVideo.vue:184", "隐私赞");
return;
}
}, 200);
}
}
function onTouchCancel() {
isTap.value = false;
tapList.length = 0;
clearTimeout(tapTimer.value);
}
function changeVideoPlay() {
if (playState.value)
pause();
else
play();
}
function play() {
let pages = getCurrentPages();
let page = pages[pages.length - 1];
if (props.index != props.current || !["pages/index/index", "pages/index/videoDetail"].includes(page.route))
return;
videoCtx.value.play();
}
function pause() {
videoCtx.value.pause();
}
function onVideoPlay() {
playState.value = true;
emit("onPlay");
}
function onVideoPause() {
playState.value = false;
emit("onPause");
}
function handleComment() {
emit("showComment", props.item);
}
function handleTime() {
emit("showTime");
}
function showCollect() {
util$1.isLogin().then((rs) => {
emit("showCollect", props.item);
}).catch(() => {
uni.navigateTo({
url: "/pages/login/loginPhone"
});
});
}
function handleCollectFirst(ev) {
const changedTouches = ev.changedTouches[0];
let x = getNumber(props.width) - getNumber(changedTouches.screenX) + getNumber(changedTouches.pageX);
let y = getNumber(changedTouches.screenY) - getNumber(changedTouches.pageY);
emit("showFastCollect", {
item: props.item,
position: {
x,
y
}
});
return;
}
function handleCollectStar(ev) {
collectBtnActive.value = true;
util$1.isLogin().then((rs) => {
setTimeout(() => {
if (!collectBtnActive.value) {
if (!props.item.isCollect) {
handleCollectFirst(ev);
return;
} else
cancelCollect();
} else {
setTimeout(() => {
showCollect();
}, 350);
}
}, 350);
}).catch(() => {
uni.navigateTo({
url: "/pages/login/loginPhone"
});
});
}
function handleCollectEnd() {
collectBtnActive.value = false;
}
function getNumber(str) {
let result = Math.floor(Number(str));
return result;
}
function cancelCollect() {
const detail = {
...props.item
};
api.video.cancelCollect({
query: {
// 视频id
videoId: detail.videoId
}
}).then((rs) => {
if (rs.code == 200) {
detail.isCollect = false;
detail.collect--;
uni.$emit("updateVideo", detail);
return;
}
util$1.alert({
content: rs.msg,
showCancel: false
});
});
}
function handleShareFirend() {
util$1.isLogin().then((rs) => {
emit("showShareFirend", props.item);
}).catch(() => {
uni.navigateTo({
url: "/pages/login/loginPhone"
});
});
}
function handleLike(index, isLike) {
util$1.isLogin().then((rs) => {
emit("like", {
index,
isLike
});
}).catch(() => {
uni.navigateTo({
url: "/pages/login/loginPhone"
});
});
}
function handlePrivateLike(index) {
util$1.isLogin().then((rs) => {
util$1.alert({
title: "提示",
content: "请确认,是否为隐私赞(隐私赞仅自己和作者可见)?",
confirmText: "隐私赞",
cancelText: "公开赞"
}).then((rs2) => {
if (rs2.confirm)
emit("like", {
index,
isLike: 3
});
else
emit("like", {
index,
isLike: 0
});
});
}).catch(() => {
uni.navigateTo({
url: "/pages/login/loginPhone"
});
});
}
function handleDetailMenu(item) {
emit("detailMenu");
}
function handleTimeupdate(ev) {
videoTime.value = ev.detail;
}
function onProgressEnd(ev) {
videoCtx.value.seek(parseInt(ev.time));
}
function handleUser(item) {
uni.navigateTo({
url: util$1.setUrl("/pages/index/videoHome", {
userId: item.userId
})
});
}
function handleWaiting(ev) {
if (props.index == props.current)
play();
else
pause();
}
function longtap(ev) {
if (isLong.value)
return;
play();
isLong.value = true;
videoCtx.value.playbackRate(2);
}
__expose({
play,
pause,
videoTime,
item: props.item,
playState,
videoCtx: () => videoCtx.value
});
const __returned__ = { proxy, props, emit, videoCtx, playState, collectFirst, videoTime, tapList, tapTimer, isTap, isLong, collectBtnActive, alarmTime, fit, formatNumber, onTouchStart, onTouchEnd, onTouchCancel, changeVideoPlay, play, pause, onVideoPlay, onVideoPause, handleComment, handleTime, showCollect, handleCollectFirst, handleCollectStar, handleCollectEnd, getNumber, cancelCollect, handleShareFirend, handleLike, handlePrivateLike, handleDetailMenu, handleTimeupdate, onProgressEnd, handleUser, handleWaiting, longtap, onMounted, ref, reactive, getCurrentInstance, watch, computed, nextTick, statusBar, get util() {
return util$1;
}, get api() {
return api;
}, get videoProgress() {
return videoProgress;
} };
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
return __returned__;
}
};
function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
const _component_navigator = resolveComponent("navigator");
const _component_uni_icons = resolveEasycom(resolveDynamicComponent("uni-icons"), __easycom_0);
return openBlock(), createElementBlock(
"view",
{
class: "container f1 pr",
ref: "videoBoxRef",
renderWhole: true
},
[
createCommentVNode(" 视频层 "),
createElementVNode("view", { class: "main f1" }, [
createElementVNode(
"view",
{
class: "videoBox f1",
onTouchmove: _cache[0] || (_cache[0] = withModifiers(() => {
}, ["stop"])),
onTouchstart: $setup.onTouchStart,
onTouchend: $setup.onTouchEnd,
onTouchcancel: $setup.onTouchCancel,
onLongpress: $setup.longtap
},
[
createVNode($setup["statusBar"]),
createCommentVNode(" 视频 增加判断防止重复加载 "),
$props.item.videoUrl ? (openBlock(), createElementBlock("u-video", {
key: 0,
class: "video f1",
id: "video" + $props.tabIndex + $props.index,
src: $props.item.videoUrl,
poster: $props.item.coverUrl,
httpCache: true,
showFullscreenBtn: false,
enableProgressGesture: false,
controls: false,
onPlay: $setup.onVideoPlay,
onPause: $setup.onVideoPause,
showCenterPlayBtn: false,
onTimeupdate: $setup.handleTimeupdate,
onWaiting: $setup.handleWaiting,
playStrategy: 2,
loop: true,
objectFit: $setup.fit
}, null, 40, ["id", "src", "poster", "objectFit"])) : createCommentVNode("v-if", true)
],
32
/* NEED_HYDRATION */
),
createCommentVNode(" 视频进度条 "),
createElementVNode(
"view",
{
class: "videoProgress",
onTouchmove: _cache[1] || (_cache[1] = withModifiers(() => {
}, ["stop"])),
onTouchstart: _cache[2] || (_cache[2] = withModifiers(() => {
}, ["stop"])),
onTouchend: _cache[3] || (_cache[3] = withModifiers(() => {
}, ["stop"]))
},
[
createVNode($setup["videoProgress"], {
time: $setup.videoTime,
onChange: $setup.onProgressEnd,
viewWidth: $props.width
}, null, 8, ["time", "viewWidth"])
],
32
/* NEED_HYDRATION */
)
]),
createCommentVNode(" 倍速播放提示 "),
$setup.isLong ? (openBlock(), createElementBlock("view", {
key: 0,
class: "speedBox"
}, [
createElementVNode("view", { class: "speed ptb5 plr10" }, [
createElementVNode("u-text", { class: "f22 cfff" }, "2倍速播放中...")
])
])) : createCommentVNode("v-if", true),
createCommentVNode(" 暂停蒙版 "),
!$setup.playState ? (openBlock(), createElementBlock("view", {
key: 1,
class: "pausePanel pfull fmid"
}, [
createCommentVNode(" 暂停按钮 "),
createElementVNode("u-image", {
class: "pauseImg",
src: _imports_0$2,
mode: "aspectFit"
})
])) : createCommentVNode("v-if", true),
createCommentVNode(" 右侧操作区 "),
createElementVNode("view", { class: "panelRight pa t0 b0 r0" }, [
createVNode($setup["statusBar"]),
createElementVNode("view", { class: "head" }),
createElementVNode("view", { class: "f1 jcr pl5 pt40 pr20" }, [
createCommentVNode(" 操作台 "),
createElementVNode("view", { class: "operate f1" }, [
createCommentVNode(" 用户头像 "),
createVNode(_component_navigator, {
url: $setup.util.setUrl("/pages/index/videoHome", { userId: $props.item.userId }),
class: "item pr mb10"
}, {
default: withCtx(() => [
createElementVNode("view", { class: "col" }, [
createElementVNode("u-image", {
class: "wh80 cir",
src: $props.item.avatar,
mode: "aspectFill"
}, null, 8, ["src"]),
!$props.item.isAttention ? (openBlock(), createElementBlock("view", {
key: 0,
class: "focus pa"
}, [
createElementVNode("u-image", {
class: "wh40",
src: _imports_1,
mode: "aspectFit"
})
])) : createCommentVNode("v-if", true)
])
]),
_: 1
/* STABLE */
}, 8, ["url"]),
createCommentVNode(" 点赞 "),
createElementVNode("view", { class: "item" }, [
createElementVNode("view", { class: "col" }, [
createElementVNode("view", { class: "pr" }, [
$props.item.isLike == 0 ? (openBlock(), createElementBlock(
"u-image",
{
key: 0,
class: "wh50",
src: _imports_2,
mode: "aspectFit",
onClick: _cache[4] || (_cache[4] = ($event) => $setup.handleLike($props.index, 0)),
onLongpress: _cache[5] || (_cache[5] = ($event) => $setup.handlePrivateLike($props.index))
},
null,
32
/* NEED_HYDRATION */
)) : $props.item.isLike == 1 ? (openBlock(), createElementBlock("u-image", {
key: 1,
class: "wh50",
src: _imports_3,
mode: "aspectFit",
onClick: _cache[6] || (_cache[6] = ($event) => $setup.handleLike($props.index, 1))
})) : $props.item.isLike == 3 ? (openBlock(), createElementBlock(
Fragment,
{ key: 2 },
[
createCommentVNode(" 私密赞的图标 "),
createElementVNode("u-image", {
class: "wh50",
src: _imports_4,
mode: "aspectFit",
onClick: _cache[7] || (_cache[7] = ($event) => $setup.handleLike($props.index, 1))
})
],
2112
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
)) : createCommentVNode("v-if", true)
]),
createElementVNode("view", { class: "txt mt10" }, [
createElementVNode(
"u-text",
{ class: "text" },
toDisplayString($props.item.likes),
1
/* TEXT */
)
])
])
]),
createCommentVNode(" 留言 "),
createElementVNode("view", {
class: "item",
onClick: $setup.handleComment
}, [
createElementVNode("view", { class: "col" }, [
createElementVNode("u-image", {
class: "wh50",
src: _imports_5,
mode: "aspectFit"
}),
createElementVNode("view", { class: "txt mt10" }, [
createElementVNode(
"u-text",
{ class: "text" },
toDisplayString($props.item.comment),
1
/* TEXT */
)
])
])
]),
createCommentVNode(" 收藏 "),
createElementVNode("view", { class: "item df fdr" }, [
createElementVNode(
"view",
{
class: "col",
onTouchstart: $setup.handleCollectStar,
onTouchend: $setup.handleCollectEnd,
ref: "collectBtn"
},
[
$props.item.isCollect ? (openBlock(), createElementBlock("u-image", {
key: 0,
class: "wh50",
src: _imports_6,
mode: "aspectFit"
})) : (openBlock(), createElementBlock("u-image", {
key: 1,
class: "wh50",
src: _imports_7,
mode: "aspectFit"
})),
createElementVNode("view", { class: "txt mt10" }, [
createElementVNode(
"u-text",
{ class: "text" },
toDisplayString($props.item.collect),
1
/* TEXT */
)
])
],
544
/* NEED_HYDRATION, NEED_PATCH */
)
]),
createCommentVNode(" 分享 "),
createElementVNode("view", {
class: "item",
onClick: $setup.handleShareFirend
}, [
createElementVNode("view", { class: "col" }, [
createElementVNode("u-image", {
class: "wh50",
src: _imports_8,
mode: "aspectFit"
}),
createElementVNode("view", { class: "txt mt10" }, [
createElementVNode("u-text", { class: "text" }, "分享")
])
])
]),
createCommentVNode(" 闹钟 "),
$props.mode == "list" ? (openBlock(), createElementBlock("view", {
key: 0,
class: "item money",
onClick: $setup.handleTime
}, [
createElementVNode("view", { class: "col" }, [
$setup.alarmTime ? (openBlock(), createElementBlock("u-image", {
key: 0,
class: "wh80",
src: _imports_9,
mode: "aspectFit"
})) : (openBlock(), createElementBlock("u-image", {
key: 1,
class: "wh80",
src: _imports_10,
mode: "aspectFit"
}))
])
])) : createCommentVNode("v-if", true),
createCommentVNode(" 详情菜单 "),
$props.mode == "detail" && $props.isMine == 1 ? (openBlock(), createElementBlock("view", {
key: 1,
class: "item money",
onClick: $setup.handleTime
}, [
createElementVNode("view", {
class: "col wh90 fmid tac",
onClick: $setup.handleDetailMenu
}, [
createVNode(_component_uni_icons, {
type: "more-filled",
color: "#d8d8d8",
size: "70rpx"
})
])
])) : createCommentVNode("v-if", true)
])
])
]),
createCommentVNode(" 底部用户信息 "),
createElementVNode("view", { class: "panelBottom pa l0 r0 b0 pl40 pb30" }, [
createCommentVNode(" 商品信息 "),
createCommentVNode("v-if", true),
createCommentVNode(" 用户 "),
createElementVNode("view", {
class: "user",
onClick: _cache[8] || (_cache[8] = ($event) => $setup.handleUser($props.item))
}, [
createElementVNode(
"u-text",
{ class: "cfff f36" },
"@" + toDisplayString($props.item.userNickname),
1
/* TEXT */
)
]),
createCommentVNode(" 简介 "),
createElementVNode("view", { class: "desc mt5" }, [
createElementVNode(
"u-text",
{ class: "t2hd cfff f28" },
toDisplayString($props.item.title),
1
/* TEXT */
)
])
])
],
512
/* NEED_PATCH */
);
}
const indexVideo = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["render", _sfc_render$7], ["styles", [_style_0$6]], ["__file", "D:/document/九亿商城/jy/jiuyi2/components/index/indexVideo.vue"]]);
const _style_0$5 = { "scroll": { ".commentAreaAlt .listBox ": { "height": "1000rpx" } }, "line": { ".commentAreaAlt ": { "width": 40, "borderBottomWidth": "2rpx", "borderBottomStyle": "solid", "borderBottomColor": "#D8D8D8" } }, "inputArea": { ".commentAreaAlt ": { "boxShadow": "0px 8px 20px 0px rgba(0, 0, 0, 0.3)" } } };
const _sfc_main$6 = {
__name: "commentArea",
setup(__props, { expose: __expose }) {
const {
proxy
} = getCurrentInstance();
let detail = reactive({});
let content = ref("");
const showLoad = ref(true);
let listProperty = reactive({
data: [],
pageSize: 10,
pageNum: 1,
total: 0
});
const reply = reactive({});
const placeholder = computed(() => {
let result = "评论一下吧~";
if (reply.id)
result = `回复 @${reply.userNickname}`;
return result;
});
const paddingHeight = ref(0);
onMounted(() => {
uni.onKeyboardHeightChange((rs) => {
paddingHeight.value = rs.height;
});
});
onBeforeUnmount(() => {
uni.offKeyboardHeightChange((rs) => {
formatAppLog("log", "at components/index/commentArea.vue:56", "rs", rs);
});
});
function refreshList() {
listProperty.total = 0;
listProperty.pageNum = 1;
getList();
}
function getList() {
api.video.commentList({
query: {
videoId: detail.videoId,
pageSize: listProperty.pageSize,
pageNume: listProperty.pageNum
}
}).then((rs) => {
formatAppLog("log", "at components/index/commentArea.vue:77", "commentList", rs);
if (rs.code == 200) {
if (listProperty.pageNum == 1)
listProperty.data.length = 0;
listProperty.data.push(...rs.rows.map((item) => {
item.pageSize = 10;
item.pageNum = 0;
item.child = [];
item.formatUserPortrait = util$1.format_url(item.userPortrait, "img");
item.childShow = true;
return item;
}));
listProperty.total = rs.total;
return;
}
util$1.alert({
content: rs.msg,
showCancel: false
});
}).finally(() => {
showLoad.value = false;
});
}
function handleSubmit() {
if (!content.value) {
util$1.alert("请输入评论的内容");
return;
}
api.video.comment({
query: {
partentId: reply.id ? reply.id : 0,
videoId: detail.videoId,
context: content.value
}
}).then((rs) => {
if (rs.code == 200) {
proxy.$refs.comment.close();
detail.comment++;
refreshList();
setTimeout(() => {
content.value = "";
}, 500);
uni.$emit("updateVideo", detail);
return;
}
util$1.alert({
content: rs.msg,
showCancel: false
});
});
}
function open(item) {
if (detail.videoId != item.videoId) {
Object.assign(detail, {}, item);
refreshList();
}
proxy.$refs.commentArea.open();
}
function close() {
proxy.$refs.commentArea.close();
}
function handleReply(item) {
Object.assign(reply, item);
proxy.$refs.comment.open();
}
function showComment() {
reply.id = "";
proxy.$refs.comment.open();
}
function handleExpansion(item, index) {
if (item.childShow == false) {
item.childShow = true;
return;
}
if (item.child.length >= item.num && item.childShow) {
item.childShow = false;
return;
}
item.pageNum++;
getLevelCommentList(item, index);
}
function getLevelCommentList(item, index) {
api.video.levelCommentList({
query: {
commentId: item.id,
pageSize: item.pageSize,
pageNum: item.pageNum
}
}).then((rs) => {
if (rs.code == 200) {
listProperty.data[index].child.push(...rs.rows.map((node) => {
node.formatUserPortrait = util$1.format_url(node.userPortrait, "img");
return node;
}));
item.childShow = true;
return;
}
util$1.alert({
content: rs.msg,
showCancel: false
});
});
}
function handleLike(item) {
util$1.isLogin().then((rs) => {
api.video.thumbsUp({
query: {
// 0取消 1点赞
type: item.isLike ? 0 : 1,
// 评论id
commentId: item.id
}
}).then((rs2) => {
if (rs2.code == 200) {
if (item.isLike)
item.likes--;
else
item.likes++;
item.isLike = !item.isLike;
listProperty.data = JSON.parse(JSON.stringify(listProperty.data));
return;
}
util$1.alert({
content: rs2.msg,
showCancel: false
});
});
}).catch(() => {
uni.navigateTo({
url: "/pages/login/loginPhone"
});
});
}
function toUser(user) {
uni.navigateTo({
url: util$1.setUrl("/pages/index/videoHome", {
userId: user.userId
})
});
}
__expose({
open,
close
});
const __returned__ = { proxy, get detail() {
return detail;
}, set detail(v) {
detail = v;
}, get content() {
return content;
}, set content(v) {
content = v;
}, showLoad, get listProperty() {
return listProperty;
}, set listProperty(v) {
listProperty = v;
}, reply, placeholder, paddingHeight, refreshList, getList, handleSubmit, open, close, handleReply, showComment, handleExpansion, getLevelCommentList, handleLike, toUser, onMounted, ref, reactive, getCurrentInstance, watch, computed, onBeforeUnmount, get util() {
return util$1;
}, get api() {
return api;
} };
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
return __returned__;
}
};
function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
const _component_uni_icons = resolveEasycom(resolveDynamicComponent("uni-icons"), __easycom_0);
const _component_rich_text = resolveComponent("rich-text");
const _component_uni_popup = resolveEasycom(resolveDynamicComponent("uni-popup"), __easycom_1$1);
return openBlock(), createElementBlock(
Fragment,
null,
[
createCommentVNode(" 评论区 "),
createVNode(
_component_uni_popup,
{
ref: "commentArea",
type: "bottom"
},
{
default: withCtx(() => [
createElementVNode("view", { class: "commentAreaAlt popBot bfff" }, [
$setup.showLoad ? (openBlock(), createElementBlock("view", {
key: 0,
class: "showLoad fmid ptb30"
}, [
createVNode(_component_uni_icons, { type: "spinner-cycle" }),
createElementVNode("u-text", { class: "c666 f28" }, "加载中...")
])) : (openBlock(), createElementBlock("view", {
key: 1,
class: "listBox"
}, [
createElementVNode("scroll-view", {
scrollY: "",
class: "scroll plr20",
showScrollbar: false
}, [
createElementVNode("view", { class: "list ptb40" }, [
(openBlock(true), createElementBlock(
Fragment,
null,
renderList($setup.listProperty.data, (item, index) => {
return openBlock(), createElementBlock("view", {
class: "item mtb20",
key: index
}, [
createElementVNode("view", { class: "df fdr" }, [
createCommentVNode(" 头像 "),
createElementVNode("u-image", {
class: "wh70 cir",
src: item.formatUserPortrait,
mode: "aspectFill",
onClick: ($event) => $setup.toUser(item)
}, null, 8, ["src", "onClick"]),
createElementVNode("view", { class: "col ml20 f1" }, [
createCommentVNode(" 用户信息和点赞 "),
createElementVNode("view", { class: "df fdr" }, [
createElementVNode("view", { class: "f1" }, [
createElementVNode("u-text", {
class: "c666 f24",
onClick: ($event) => $setup.toUser(item)
}, toDisplayString(item.userNickname), 9, ["onClick"]),
createVNode(_component_rich_text, {
class: "mt5 c333 f28",
nodes: item.context
}, null, 8, ["nodes"])
]),
createElementVNode("view", {
class: "like oh aic pl20",
onClick: ($event) => $setup.handleLike(item)
}, [
createVNode(_component_uni_icons, {
type: "heart-filled",
color: item.isLike ? "#F84259" : "#b3b3b3",
size: "32rpx"
}, null, 8, ["color"]),
createElementVNode(
"u-text",
{ class: "c333 f24" },
toDisplayString(item.likes),
1
/* TEXT */
)
], 8, ["onClick"])
]),
createCommentVNode(" 发布时间和回复 "),
createElementVNode("view", { class: "df fdr mt10" }, [
createElementVNode(
"u-text",
{ class: "c999 f24" },
toDisplayString(item.createTime),
1
/* TEXT */
),
createElementVNode("view", {
class: "ml100",
onClick: ($event) => $setup.handleReply(item)
}, [
createElementVNode("u-text", { class: "c666 f24" }, "回复")
], 8, ["onClick"])
]),
item.num != 0 ? (openBlock(), createElementBlock(
Fragment,
{ key: 0 },
[
createCommentVNode(" 子评论 "),
item.childShow ? (openBlock(), createElementBlock("view", {
key: 0,
class: "child"
}, [
(openBlock(true), createElementBlock(
Fragment,
null,
renderList(item.child, (secItem, secIndex) => {
return openBlock(), createElementBlock("view", {
class: "df fdr mt15",
key: secItem.id
}, [
createCommentVNode(" 头像 "),
createElementVNode("u-image", {
class: "wh40 cir",
src: secItem.formatUserPortrait,
mode: "aspectFill",
onClick: ($event) => $setup.toUser(secItem)
}, null, 8, ["src", "onClick"]),
createElementVNode("view", { class: "col pl20 f1" }, [
createCommentVNode(" 用户信息和点赞 "),
createElementVNode("view", { class: "df fdr" }, [
createElementVNode("view", { class: "f1" }, [
createElementVNode("u-text", {
class: "c333 f24",
onClick: ($event) => $setup.toUser(secItem)
}, toDisplayString(secItem.userNickname), 9, ["onClick"]),
createVNode(_component_rich_text, {
class: "mt5 c333 f28",
nodes: secItem.context
}, null, 8, ["nodes"])
]),
createElementVNode("view", {
class: "like oh aic pl20",
onClick: ($event) => $setup.handleLike(secItem)
}, [
createVNode(_component_uni_icons, {
type: "heart-filled",
color: secItem.isLike ? "#F84259" : "#b3b3b3",
size: "32rpx"
}, null, 8, ["color"]),
createElementVNode(
"u-text",
{ class: "c333 f24" },
toDisplayString(secItem.likes),
1
/* TEXT */
)
], 8, ["onClick"])
]),
createCommentVNode(" 发布时间和回复 "),
createElementVNode("view", { class: "df fdr mt10" }, [
createElementVNode(
"u-text",
{ class: "c999 f24" },
toDisplayString(secItem.createTime),
1
/* TEXT */
),
createCommentVNode("v-if", true)
])
])
]);
}),
128
/* KEYED_FRAGMENT */
))
])) : createCommentVNode("v-if", true),
createElementVNode("view", {
class: "df fdr aic mt20",
onClick: ($event) => $setup.handleExpansion(item, index)
}, [
createElementVNode("view", { class: "line mr10" }),
item.childShow ? (openBlock(), createElementBlock(
Fragment,
{ key: 0 },
[
item.num == item.child.length ? (openBlock(), createElementBlock(
Fragment,
{ key: 0 },
[
createElementVNode("u-text", { class: "c666 f24" }, "收起"),
createVNode(_component_uni_icons, { type: "top" })
],
64
/* STABLE_FRAGMENT */
)) : (openBlock(), createElementBlock(
Fragment,
{ key: 1 },
[
createElementVNode(
"u-text",
{ class: "c666 f24" },
"展开" + toDisplayString(item.num - item.child.length) + "条回复",
1
/* TEXT */
),
createVNode(_component_uni_icons, { type: "bottom" })
],
64
/* STABLE_FRAGMENT */
))
],
64
/* STABLE_FRAGMENT */
)) : (openBlock(), createElementBlock(
Fragment,
{ key: 1 },
[
createElementVNode(
"u-text",
{ class: "c666 f24" },
"展开" + toDisplayString(item.num) + "条回复",
1
/* TEXT */
),
createVNode(_component_uni_icons, { type: "bottom" })
],
64
/* STABLE_FRAGMENT */
))
], 8, ["onClick"])
],
64
/* STABLE_FRAGMENT */
)) : createCommentVNode("v-if", true)
])
])
]);
}),
128
/* KEYED_FRAGMENT */
))
]),
!$setup.listProperty.data[0] ? (openBlock(), createElementBlock("view", {
key: 0,
class: "fmid fdr"
}, [
createElementVNode("u-text", { class: "nomore f32" }, "暂无评论,快来抢沙发吧~")
])) : (openBlock(), createElementBlock("view", {
key: 1,
class: "fmid fdr"
}, [
createElementVNode("u-text", { class: "nomore" }, "暂无更多")
]))
])
])),
createElementVNode("view", {
class: "inputArea ptb20 plr20",
onClick: $setup.showComment
}, [
createElementVNode("view", { class: "inputBox ptb10 plr10" }, [
createElementVNode("u-text", { class: "placeholderStyle f28" }, "评论一下吧~")
])
])
])
]),
_: 1
/* STABLE */
},
512
/* NEED_PATCH */
),
createCommentVNode(" 回复弹窗 "),
createVNode(
_component_uni_popup,
{
ref: "comment",
type: "bottom"
},
{
default: withCtx(() => [
createElementVNode("view", { class: "popBot ptb30 plr30 bfff" }, [
createElementVNode("u-textarea", {
modelValue: $setup.content,
onInput: _cache[0] || (_cache[0] = ($event) => $setup.content = $event.detail.value),
adjustPosition: false,
class: "textarea",
placeholder: $setup.placeholder
}, null, 40, ["modelValue", "placeholder"]),
createElementVNode("view", { class: "df fdr jcr" }, [
createElementVNode("view", {
class: "btn sm black plr20",
onClick: $setup.handleSubmit
}, [
createElementVNode("u-text", { class: "cfff f28" }, "发送")
])
]),
createElementVNode(
"view",
{
style: normalizeStyle({ height: $setup.paddingHeight + "px" })
},
null,
4
/* STYLE */
)
])
]),
_: 1
/* STABLE */
},
512
/* NEED_PATCH */
)
],
64
/* STABLE_FRAGMENT */
);
}
const commentAlt = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["render", _sfc_render$6], ["styles", [_style_0$5]], ["__file", "D:/document/九亿商城/jy/jiuyi2/components/index/commentArea.vue"]]);
let mpMixins = {};
let bindIngXMixins = {};
const BindingX = requireNativePlugin("bindingx");
const dom = requireNativePlugin("dom");
const animation = requireNativePlugin("animation");
bindIngXMixins = {
data() {
return {};
},
watch: {
show(newVal) {
if (this.autoClose)
return;
if (this.stop)
return;
this.stop = true;
if (newVal) {
this.open(newVal);
} else {
this.close();
}
},
leftOptions() {
this.getSelectorQuery();
this.init();
},
rightOptions(newVal) {
this.init();
}
},
created() {
this.swipeaction = this.getSwipeAction();
if (this.swipeaction && Array.isArray(this.swipeaction.children)) {
this.swipeaction.children.push(this);
}
},
mounted() {
this.box = this.getEl(this.$refs["selector-box--hock"]);
this.selector = this.getEl(this.$refs["selector-content--hock"]);
this.leftButton = this.getEl(this.$refs["selector-left-button--hock"]);
this.rightButton = this.getEl(this.$refs["selector-right-button--hock"]);
this.init();
},
// beforeDestroy() {
// this.swipeaction.children.forEach((item, index) => {
// if (item === this) {
// this.swipeaction.children.splice(index, 1)
// }
// })
// },
methods: {
init() {
this.$nextTick(() => {
this.x = 0;
this.button = {
show: false
};
setTimeout(() => {
this.getSelectorQuery();
}, 200);
});
},
onClick(index, item, position) {
this.$emit("click", {
content: item,
index,
position
});
},
touchstart(e) {
if (this.disabled)
return;
if (this.stop)
return;
this.stop = true;
if (this.autoClose && this.swipeaction) {
this.swipeaction.closeOther(this);
}
const leftWidth = this.button.left.width;
const rightWidth = this.button.right.width;
let expression = this.range(this.x, -rightWidth, leftWidth);
let leftExpression = this.range(this.x - leftWidth, -leftWidth, 0);
let rightExpression = this.range(this.x + rightWidth, 0, rightWidth);
this.eventpan = BindingX.bind({
anchor: this.box,
eventType: "pan",
props: [{
element: this.selector,
property: "transform.translateX",
expression
}, {
element: this.leftButton,
property: "transform.translateX",
expression: leftExpression
}, {
element: this.rightButton,
property: "transform.translateX",
expression: rightExpression
}]
}, (e2) => {
if (e2.state === "end") {
this.x = e2.deltaX + this.x;
this.isclick = true;
this.bindTiming(e2.deltaX);
}
});
},
touchend(e) {
if (this.isopen !== "none" && !this.isclick) {
this.open("none");
}
},
bindTiming(x) {
const left = this.x;
const leftWidth = this.button.left.width;
const rightWidth = this.button.right.width;
const threshold = this.threshold;
if (!this.isopen || this.isopen === "none") {
if (left > threshold) {
this.open("left");
} else if (left < -threshold) {
this.open("right");
} else {
this.open("none");
}
} else {
if (x > -leftWidth && x < 0 || x > rightWidth) {
if (x > -threshold && x < 0 || x - rightWidth > threshold) {
this.open("left");
} else {
this.open("none");
}
} else {
if (x < threshold && x > 0 || x + leftWidth < -threshold) {
this.open("right");
} else {
this.open("none");
}
}
}
},
/**
* 移动范围
* @param {Object} num
* @param {Object} mix
* @param {Object} max
*/
range(num, mix, max) {
return `min(max(x+${num}, ${mix}), ${max})`;
},
/**
* 开启swipe
*/
open(type) {
this.animation(type);
},
/**
* 关闭swipe
*/
close() {
this.animation("none");
},
/**
* 开启关闭动画
* @param {Object} type
*/
animation(type) {
const leftWidth = this.button.left.width;
const rightWidth = this.button.right.width;
if (this.eventpan && this.eventpan.token) {
BindingX.unbind({
token: this.eventpan.token,
eventType: "pan"
});
}
switch (type) {
case "left":
Promise.all([
this.move(this.selector, leftWidth),
this.move(this.leftButton, 0),
this.move(this.rightButton, rightWidth * 2)
]).then(() => {
this.setEmit(leftWidth, type);
});
break;
case "right":
Promise.all([
this.move(this.selector, -rightWidth),
this.move(this.leftButton, -leftWidth * 2),
this.move(this.rightButton, 0)
]).then(() => {
this.setEmit(-rightWidth, type);
});
break;
default:
Promise.all([
this.move(this.selector, 0),
this.move(this.leftButton, -leftWidth),
this.move(this.rightButton, rightWidth)
]).then(() => {
this.setEmit(0, type);
});
}
},
setEmit(x, type) {
const leftWidth = this.button.left.width;
const rightWidth = this.button.right.width;
this.isopen = this.isopen || "none";
this.stop = false;
this.isclick = false;
if (this.isopen !== type && this.x !== x) {
if (type === "left" && leftWidth > 0) {
this.$emit("change", "left");
}
if (type === "right" && rightWidth > 0) {
this.$emit("change", "right");
}
if (type === "none") {
this.$emit("change", "none");
}
}
this.x = x;
this.isopen = type;
},
move(ref2, value) {
return new Promise((resolve, reject) => {
animation.transition(ref2, {
styles: {
transform: `translateX(${value})`
},
duration: 150,
//ms
timingFunction: "linear",
needLayout: false,
delay: 0
//ms
}, function(res) {
resolve(res);
});
});
},
/**
* 获取ref
* @param {Object} el
*/
getEl(el) {
return el.ref;
},
/**
* 获取节点信息
*/
getSelectorQuery() {
Promise.all([
this.getDom("left"),
this.getDom("right")
]).then((data) => {
let show = "none";
if (this.autoClose) {
show = "none";
} else {
show = this.show;
}
if (show === "none")
;
else {
this.open(show);
}
});
},
getDom(str) {
return new Promise((resolve, reject) => {
dom.getComponentRect(this.$refs[`selector-${str}-button--hock`], (data) => {
if (data) {
this.button[str] = data.size;
resolve(data);
} else {
reject();
}
});
});
}
}
};
const bindingx = bindIngXMixins;
let otherMixins = {};
const _style_0$4 = { "uni-swipe": { "": { "position": "relative" } }, "uni-swipe_box": { "": { "position": "relative" } }, "uni-swipe_text--center": { "": { "width": 100 } }, "uni-swipe_button-group": { "": { "flexDirection": "row", "position": "absolute", "top": 0, "bottom": 0 } }, "button-group--left": { "": { "left": 0, "transform": "translateX(-100%)" } }, "button-group--right": { "": { "right": 0, "transform": "translateX(100%)" } }, "uni-swipe_button": { "": { "flex": 1, "flexDirection": "row", "justifyContent": "center", "alignItems": "center", "paddingTop": 0, "paddingRight": 20, "paddingBottom": 0, "paddingLeft": 20 } }, "uni-swipe_button-text": { "": { "fontSize": 14 } }, "ani": { "": { "transitionProperty": "transform", "transitionDuration": 300, "transitionTimingFunction": "cubic-bezier(0.165,0.84,0.44,1)" } }, "@TRANSITION": { "ani": { "property": "transform", "duration": 300, "timingFunction": "cubic-bezier(0.165,0.84,0.44,1)" } } };
const block0 = {};
const block1 = {};
const _sfc_main$5 = {
mixins: [mpMixins, bindingx, otherMixins],
emits: ["click", "change"],
props: {
// 控制开关
show: {
type: String,
default: "none"
},
// 禁用
disabled: {
type: Boolean,
default: false
},
// 是否自动关闭
autoClose: {
type: Boolean,
default: true
},
// 滑动缺省距离
threshold: {
type: Number,
default: 20
},
// 左侧按钮内容
leftOptions: {
type: Array,
default() {
return [];
}
},
// 右侧按钮内容
rightOptions: {
type: Array,
default() {
return [];
}
}
},
// TODO vue3
unmounted() {
this.__isUnmounted = true;
this.uninstall();
},
methods: {
uninstall() {
if (this.swipeaction) {
this.swipeaction.children.forEach((item, index) => {
if (item === this) {
this.swipeaction.children.splice(index, 1);
}
});
}
},
/**
* 获取父元素实例
*/
getSwipeAction(name = "uniSwipeAction") {
let parent = this.$parent;
let parentName = parent.$options.name;
while (parentName !== name) {
parent = parent.$parent;
if (!parent)
return false;
parentName = parent.$options.name;
}
return parent;
}
}
};
function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
return openBlock(), createElementBlock(
Fragment,
null,
[
createCommentVNode(" 在微信小程序 app vue端 h5 使用wxs 实现"),
createCommentVNode(" app nvue端 使用 bindingx "),
createElementVNode(
"view",
{
ref: "selector-box--hock",
class: "uni-swipe",
onHorizontalpan: _cache[0] || (_cache[0] = (...args) => _ctx.touchstart && _ctx.touchstart(...args)),
onTouchend: _cache[1] || (_cache[1] = (...args) => _ctx.touchend && _ctx.touchend(...args))
},
[
createElementVNode(
"view",
{
ref: "selector-left-button--hock",
class: "uni-swipe_button-group button-group--left"
},
[
renderSlot(_ctx.$slots, "left", {}, () => [
(openBlock(true), createElementBlock(
Fragment,
null,
renderList($props.leftOptions, (item, index) => {
return openBlock(), createElementBlock("view", {
key: index,
style: normalizeStyle({
backgroundColor: item.style && item.style.backgroundColor ? item.style.backgroundColor : "#C7C6CD"
}),
class: "uni-swipe_button button-hock",
onClick: withModifiers(($event) => _ctx.onClick(index, item, "left"), ["stop"])
}, [
createElementVNode(
"u-text",
{
class: "uni-swipe_button-text",
style: normalizeStyle({ color: item.style && item.style.color ? item.style.color : "#FFFFFF", fontSize: item.style && item.style.fontSize ? item.style.fontSize : "16px" })
},
toDisplayString(item.text),
5
/* TEXT, STYLE */
)
], 12, ["onClick"]);
}),
128
/* KEYED_FRAGMENT */
))
])
],
512
/* NEED_PATCH */
),
createElementVNode(
"view",
{
ref: "selector-right-button--hock",
class: "uni-swipe_button-group button-group--right"
},
[
renderSlot(_ctx.$slots, "right", {}, () => [
(openBlock(true), createElementBlock(
Fragment,
null,
renderList($props.rightOptions, (item, index) => {
return openBlock(), createElementBlock("view", {
key: index,
style: normalizeStyle({
backgroundColor: item.style && item.style.backgroundColor ? item.style.backgroundColor : "#C7C6CD"
}),
class: "uni-swipe_button button-hock",
onClick: withModifiers(($event) => _ctx.onClick(index, item, "right"), ["stop"])
}, [
createElementVNode(
"u-text",
{
class: "uni-swipe_button-text",
style: normalizeStyle({ color: item.style && item.style.color ? item.style.color : "#FFFFFF", fontSize: item.style && item.style.fontSize ? item.style.fontSize : "16px" })
},
toDisplayString(item.text),
5
/* TEXT, STYLE */
)
], 12, ["onClick"]);
}),
128
/* KEYED_FRAGMENT */
))
])
],
512
/* NEED_PATCH */
),
createElementVNode(
"view",
{
ref: "selector-content--hock",
class: "uni-swipe_box"
},
[
renderSlot(_ctx.$slots, "default")
],
512
/* NEED_PATCH */
)
],
544
/* NEED_HYDRATION, NEED_PATCH */
),
createCommentVNode(" 其他平台使用 js ,长列表性能可能会有影响")
],
2112
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
);
}
if (typeof block0 === "function")
block0(_sfc_main$5);
if (typeof block1 === "function")
block1(_sfc_main$5);
const __easycom_1 = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["render", _sfc_render$5], ["styles", [_style_0$4]], ["__file", "D:/document/九亿商城/jy/jiuyi2/uni_modules/uni-swipe-action/components/uni-swipe-action-item/uni-swipe-action-item.vue"]]);
const _sfc_main$4 = {
name: "uniSwipeAction",
data() {
return {};
},
created() {
this.children = [];
},
methods: {
// 公开给用户使用,重制组件样式
resize() {
this.children.forEach((vm) => {
vm.init();
});
},
// 公开给用户使用,关闭全部 已经打开的组件
closeAll() {
this.children.forEach((vm) => {
vm.close();
});
},
closeOther(vm) {
if (this.openItem && this.openItem !== vm) {
this.openItem.close();
}
this.openItem = vm;
}
}
};
function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
return openBlock(), createElementBlock("view", { renderWhole: true }, [
renderSlot(_ctx.$slots, "default")
]);
}
const __easycom_2 = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["render", _sfc_render$4], ["__file", "D:/document/九亿商城/jy/jiuyi2/uni_modules/uni-swipe-action/components/uni-swipe-action/uni-swipe-action.vue"]]);
const _imports_0$1 = "/static/lock.png";
const _style_0$3 = { "switch": { "": { "transform": "scale(0.7)" } } };
const _sfc_main$3 = {
__name: "collectAdd",
setup(__props, { expose: __expose }) {
const {
proxy
} = getCurrentInstance();
class Form {
constructor() {
// 收藏夹名称
__publicField(this, "collectName", "");
// 0公开1私密
__publicField(this, "isPrivate", 0);
// 图片地址
__publicField(this, "pic", "");
// 收藏id
__publicField(this, "collectId", "");
}
}
const form = reactive(new Form());
const paddingHeight = ref(0);
onMounted(() => {
uni.onKeyboardHeightChange((rs) => {
paddingHeight.value = rs.height;
});
});
onBeforeUnmount(() => {
uni.offKeyboardHeightChange((rs) => {
formatAppLog("log", "at components/index/collectAdd.vue:46", "rs", rs);
});
});
function open(value) {
if (value) {
form.collectName = value.collectName;
form.isPrivate = value.isPrivate;
form.collectId = value.id;
form.pic = value.formatPic;
}
proxy.$refs.addCollectRef.open();
}
function close() {
proxy.$refs.addCollectRef.close();
}
function upImage() {
util$1.upload_image({
value: form.pic,
type: 1,
success: (rs) => {
form.pic = rs.value;
}
});
}
function handlePrivate() {
form.isPrivate = form.isPrivate == 0 ? 1 : 0;
}
function handleSubmit() {
const data = {
...form
};
if (!form.collectName) {
util$1.alert("请输入收藏夹名称");
return;
}
if (!form.pic) {
util$1.alert("请上传封面图");
return;
}
data.pic = util$1.replace_url(data.pic);
let requestApi = "saveCollectList";
if (form.collectId)
requestApi = "updateCollectList";
api.video[requestApi]({
query: data
}).then((rs) => {
if (rs.code == 200) {
uni.$emit("collectsVideo");
close();
Object.assign(form, new Form());
return;
}
util$1.alert({
content: rs.msg,
showCancel: false
});
});
}
__expose({
open,
close
});
const __returned__ = { proxy, Form, form, paddingHeight, open, close, upImage, handlePrivate, handleSubmit, ref, getCurrentInstance, reactive, onMounted, onBeforeUnmount, get util() {
return util$1;
}, get api() {
return api;
} };
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
return __returned__;
}
};
function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
const _component_uni_icons = resolveEasycom(resolveDynamicComponent("uni-icons"), __easycom_0);
const _component_switch = resolveComponent("switch");
const _component_uni_popup = resolveEasycom(resolveDynamicComponent("uni-popup"), __easycom_1$1);
return openBlock(), createBlock(
_component_uni_popup,
{
ref: "addCollectRef",
type: "bottom"
},
{
default: withCtx(() => [
createElementVNode("view", { class: "addCollect popBot ptb20 plr20 bfff" }, [
createElementVNode("view", { class: "header fdr rows" }, [
createElementVNode("view", { class: "w120" }, [
createVNode(_component_uni_icons, {
type: "closeempty",
onClick: $setup.close
})
]),
createElementVNode("view", { class: "title" }, [
createElementVNode("u-text", { class: "c333 f28" }, "编辑收藏夹")
]),
createElementVNode("view", { class: "w120 tar" }, [
createElementVNode("u-text", {
class: "cFF9B27 f24",
onClick: $setup.handleSubmit
}, "确认")
])
]),
createCommentVNode(" 收藏夹信息 "),
createElementVNode("view", { class: "rows fdr mtb30" }, [
createElementVNode("view", {
class: "pic fmid wh80 beee br10",
onClick: $setup.upImage
}, [
$setup.form.pic ? (openBlock(), createElementBlock("u-image", {
key: 0,
class: "wh80 br10",
src: $setup.form.pic,
mode: "aspectFill"
}, null, 8, ["src"])) : (openBlock(), createBlock(_component_uni_icons, {
key: 1,
type: "plusempty",
size: "40rpx"
}))
]),
createElementVNode("view", { class: "edit f1 ml20" }, [
createElementVNode("u-input", {
type: "text",
adjustPosition: false,
modelValue: $setup.form.collectName,
onInput: _cache[0] || (_cache[0] = ($event) => $setup.form.collectName = $event.detail.value),
placeholder: "输入收藏夹名称"
}, null, 40, ["modelValue"])
])
]),
createCommentVNode(" 公开收藏夹 "),
createElementVNode("view", { class: "rows fdr mtb30" }, [
createElementVNode("view", { class: "df fdr aic" }, [
createElementVNode("u-text", null, "是否公开收藏夹"),
createElementVNode("u-image", {
src: _imports_0$1,
mode: "aspectFit",
class: "wh24 ml10"
})
]),
createVNode(_component_switch, {
class: "switch",
checked: $setup.form.isPrivate == 0,
color: "#F85050",
onChange: $setup.handlePrivate
}, null, 8, ["checked"])
]),
createElementVNode(
"view",
{
style: normalizeStyle({ height: $setup.paddingHeight + "px" })
},
null,
4
/* STYLE */
)
])
]),
_: 1
/* STABLE */
},
512
/* NEED_PATCH */
);
}
const collectAdd = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render$3], ["styles", [_style_0$3]], ["__file", "D:/document/九亿商城/jy/jiuyi2/components/index/collectAdd.vue"]]);
const _style_0$2 = { "item": { ".collect ": { "borderBottomWidth": "2rpx", "borderBottomStyle": "solid", "borderBottomColor": "#D8D8D8" } } };
const _sfc_main$2 = {
__name: "collectList",
emits: ["handleItem"],
setup(__props, { expose: __expose, emit: __emit }) {
const {
proxy
} = getCurrentInstance();
const showLoad = ref(true);
const listProperty = reactive({
// 数据
data: [],
// 条数
pageSize: 10,
// 页码
pageNum: 1,
// 总数
total: 0
});
const options = [{
text: "删除",
style: {
backgroundColor: "#F85050"
}
}, {
text: "编辑",
style: {
backgroundColor: "#00ADEE"
}
}];
const emit = __emit;
onMounted(() => {
addListener();
util$1.isLogin().then(() => {
setTimeout(() => {
getList();
}, 1e3);
});
});
function addListener() {
uni.$on("collectsVideo", () => {
refrshList();
});
uni.$on("login", () => {
refrshList();
});
}
function refrshList() {
listProperty.pageNum = 1;
getList();
}
function getMoreList() {
if (listProperty.total <= listProperty.data.length)
return;
listProperty.pageNum++;
getList();
}
function getList() {
api.video.getCollectList({
query: {
pageNum: listProperty.pageNum,
pageSize: listProperty.pageSize
}
}).then((rs) => {
if (rs.code === 200) {
const result = rs.rows;
if (listProperty.pageNum == 1)
listProperty.data.length = 0;
listProperty.data.push(...result.map((item) => {
item.formatPic = util$1.format_url(item.pic, "img");
return item;
}));
listProperty.total = rs.total;
return;
}
util$1.alert(rs.msg);
}).finally(() => {
showLoad.value = false;
});
}
function delectList(item, index) {
api.video.deleteCollect({
query: {
jyCollectId: item.id
}
}).then((rs) => {
if (rs.code === 200) {
listProperty.total--;
listProperty.data.splice(index, 1);
return;
}
util$1.alert({
content: rs.msg,
showCancel: false
});
});
}
function handleActionItem(ev, target) {
const index = ev.index;
const item = listProperty.data[target];
switch (index) {
case 0:
util$1.alert({
content: "确认删除收藏夹?"
}).then((rs) => {
if (rs.confirm)
delectList(item, target);
});
break;
case 1:
proxy.$refs.collectAddRef.open(item);
break;
}
proxy.$refs.swipeActionRef.closeAll();
}
function handleItem(item) {
emit("handleItem", item);
}
__expose({
getList,
getMoreList,
refrshList
});
const __returned__ = { proxy, showLoad, listProperty, options, emit, addListener, refrshList, getMoreList, getList, delectList, handleActionItem, handleItem, onMounted, reactive, ref, getCurrentInstance, get api() {
return api;
}, get util() {
return util$1;
}, collectAdd };
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
return __returned__;
}
};
function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
const _component_uni_icons = resolveEasycom(resolveDynamicComponent("uni-icons"), __easycom_0);
const _component_uni_swipe_action_item = resolveEasycom(resolveDynamicComponent("uni-swipe-action-item"), __easycom_1);
const _component_uni_swipe_action = resolveEasycom(resolveDynamicComponent("uni-swipe-action"), __easycom_2);
return openBlock(), createElementBlock(
Fragment,
null,
[
$setup.showLoad ? (openBlock(), createElementBlock("view", {
key: 0,
class: "showLoad fmid ptb30"
}, [
createVNode(_component_uni_icons, { type: "spinner-cycle" }),
createElementVNode("u-text", { class: "c666 f28" }, "加载中...")
])) : (openBlock(), createBlock(
_component_uni_swipe_action,
{
key: 1,
ref: "swipeActionRef"
},
{
default: withCtx(() => [
createElementVNode("view", { class: "collect" }, [
(openBlock(true), createElementBlock(
Fragment,
null,
renderList($setup.listProperty.data, (item, index) => {
return openBlock(), createBlock(_component_uni_swipe_action_item, {
"right-options": $setup.options,
key: index,
onClick: ($event) => $setup.handleActionItem($event, index)
}, {
default: withCtx(() => [
createElementVNode("view", {
class: "item rows fdr mlr20 ptb20",
onClick: withModifiers(($event) => $setup.handleItem(item), ["stop"])
}, [
createElementVNode("view", { class: "poster" }, [
createElementVNode("u-image", {
class: "wh80 br20",
src: item.formatPic,
mode: "aspectFill"
}, null, 8, ["src"])
]),
createElementVNode("view", { class: "oh pl20" }, [
createElementVNode(
"u-text",
{ class: "c333 f28" },
toDisplayString(item.collectName),
1
/* TEXT */
)
]),
item.isPrivate == 1 ? (openBlock(), createElementBlock("u-image", {
key: 0,
class: "wh24 ml10",
src: _imports_0$1,
mode: "aspectFit"
})) : createCommentVNode("v-if", true),
createElementVNode("view", { class: "f1" })
], 8, ["onClick"])
]),
_: 2
/* DYNAMIC */
}, 1032, ["onClick"]);
}),
128
/* KEYED_FRAGMENT */
)),
createElementVNode("view", { class: "nomore mtb20" }, [
createElementVNode("u-text", { class: "nomore" }, "暂无更多")
])
])
]),
_: 1
/* STABLE */
},
512
/* NEED_PATCH */
)),
createCommentVNode(" 收藏添加 "),
createVNode(
$setup["collectAdd"],
{ ref: "collectAddRef" },
null,
512
/* NEED_PATCH */
)
],
64
/* STABLE_FRAGMENT */
);
}
const collectList = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$2], ["styles", [_style_0$2]], ["__file", "D:/document/九亿商城/jy/jiuyi2/components/index/collectList.vue"]]);
const _imports_0 = "/static/circle.png";
const _style_0$1 = { "close": { "": { "position": "absolute", "right": "20rpx", "top": "5rpx" } }, "scroll": { "": { "height": "550rpx" } }, "add": { "": { "boxShadow": "0 8rpx 20rpx rgba(0, 0, 0, 0.3)" } }, "icon": { ".add ": { "borderWidth": "5rpx", "borderStyle": "solid", "borderColor": "#333333", "borderRadius": "5rpx" } }, "resultAlt": { "": { "marginBottom": "150rpx" } }, "circle": { ".resultAlt ": { "backgroundColor": "#FF008C" } } };
const _sfc_main$1 = {
__name: "collect",
setup(__props, { expose: __expose }) {
const {
proxy
} = getCurrentInstance();
const collectResult = ref(false);
const detail = ref({});
function handleCollect(item) {
close();
open("result");
}
function open(item) {
detail.value = item;
if (!item.isCollect) {
proxy.$refs.collect.open();
return;
}
cancelCollect();
}
function handleItem(item) {
collectVideo(item);
}
function close(key) {
if (!key)
key = "collect";
proxy.$refs[key].close();
}
function collectVideo(collects) {
api.video.collectVideo({
query: {
// 视频id
videoId: detail.value.videoId,
// 收藏夹id
collectId: collects.id,
isPrivate: collects.isPrivate
}
}).then((rs) => {
if (rs.code == 200) {
proxy.$refs.collect.close();
detail.value.isCollect = true;
detail.value.collect++;
uni.$emit("updateVideo", detail.value);
collectResult.value = true;
proxy.$refs.result.open();
setTimeout(() => {
proxy.$refs.result.close();
}, 3e3);
return;
}
util$1.alert({
content: rs.msg,
showCancel: false
});
});
}
function cancelCollect() {
api.video.cancelCollect({
query: {
// 视频id
videoId: detail.value.videoId
}
}).then((rs) => {
if (rs.code == 200) {
detail.value.isCollect = false;
detail.value.collect--;
uni.$emit("updateVideo", detail.value);
collectResult.value = false;
proxy.$refs.result.open();
setTimeout(() => {
proxy.$refs.result.close();
}, 3e3);
return;
}
util$1.alert({
content: rs.msg,
showCancel: false
});
});
}
__expose({
open,
close,
collectResult
});
const __returned__ = { proxy, collectResult, detail, handleCollect, open, handleItem, close, collectVideo, cancelCollect, onMounted, ref, reactive, getCurrentInstance, watch, collectList, get api() {
return api;
}, get util() {
return util$1;
}, collectAdd };
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
return __returned__;
}
};
function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
const _component_uni_icons = resolveEasycom(resolveDynamicComponent("uni-icons"), __easycom_0);
const _component_uni_popup = resolveEasycom(resolveDynamicComponent("uni-popup"), __easycom_1$1);
return openBlock(), createElementBlock(
Fragment,
null,
[
createCommentVNode(" 收藏列表 "),
createVNode(
_component_uni_popup,
{
ref: "collect",
type: "bottom"
},
{
default: withCtx(() => [
createElementVNode("view", { class: "popBot bfff" }, [
createElementVNode("view", {
class: "close",
onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$refs.collect.close())
}, [
createVNode(_component_uni_icons, {
type: "close",
size: "36rpx",
color: "#333"
})
]),
createCommentVNode(" 标题 "),
createElementVNode("view", { class: "title mt40" }, [
createElementVNode("u-text", { class: "tac f40" }, "选择收藏夹")
]),
createElementVNode("scroll-view", {
scrollY: "",
class: "scroll"
}, [
createVNode($setup["collectList"], { onHandleItem: $setup.handleItem })
]),
createElementVNode("view", {
class: "add df fdr aic ptb30 plr30",
onClick: _cache[1] || (_cache[1] = ($event) => _ctx.$refs.collectAddRef.open())
}, [
createElementVNode("view", { class: "icon fmid wh70" }, [
createVNode(_component_uni_icons, {
type: "plusempty",
color: "#333"
})
]),
createElementVNode("u-text", { class: "ml20 c333 f28" }, "新建收藏夹")
])
])
]),
_: 1
/* STABLE */
},
512
/* NEED_PATCH */
),
createCommentVNode(" 收藏结果 "),
createVNode(
_component_uni_popup,
{
ref: "result",
type: "bottom",
"mask-background-color": "rgba(0,0,0,0)"
},
{
default: withCtx(() => [
createElementVNode("view", { class: "resultAlt mlr30 df fdr aic ptb30 plr30 bfff br20" }, [
createElementVNode("view", { class: "circle cir" }, [
createElementVNode("u-image", {
class: "wh30",
src: _imports_0,
mode: "aspectFill"
})
]),
$setup.collectResult ? (openBlock(), createElementBlock(
Fragment,
{ key: 0 },
[
createElementVNode("u-text", { class: "f1 ml30 c333 f28" }, "收藏成功"),
createCommentVNode("v-if", true)
],
64
/* STABLE_FRAGMENT */
)) : (openBlock(), createElementBlock("u-text", {
key: 1,
class: "f1 ml30 c333 f28"
}, "已取消收藏"))
])
]),
_: 1
/* STABLE */
},
512
/* NEED_PATCH */
),
createCommentVNode(" 新增收藏 "),
createVNode(
$setup["collectAdd"],
{ ref: "collectAddRef" },
null,
512
/* NEED_PATCH */
)
],
64
/* STABLE_FRAGMENT */
);
}
const collectAlt = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1], ["styles", [_style_0$1]], ["__file", "D:/document/九亿商城/jy/jiuyi2/components/index/collect.vue"]]);
const _style_0 = { "shareBox": { "": { "height": "600rpx" } }, "firendBox": { ".shareBox ": { "height": 100 } }, "scroll": { ".shareBox .firendBox ": { "height": "500rpx" } }, "list": { ".shareBox .firendBox .scroll ": { "flexWrap": "wrap" } }, "item": { ".shareBox .firendBox .scroll .list ": { "width": "140rpx", "marginTop": "40rpx", "marginRight": 0, "marginBottom": "40rpx", "marginLeft": 0 } } };
const _sfc_main = {
__name: "shareFirend",
setup(__props, { expose: __expose }) {
const {
proxy
} = getCurrentInstance();
const userList = reactive([]);
const videoItem = reactive({});
const userinfo = computed(() => {
let result = uni.$store.state.userinfo;
return result;
});
onMounted(() => {
util$1.isLogin(() => {
getFriendList();
});
uni.$on("login", () => {
getFriendList();
});
uni.$on("logout", () => {
userList.length = 0;
});
});
onBeforeUnmount(() => {
uni.$off("login");
uni.$off("logout");
});
function getFriendList() {
let isReady = uni.$chat.isReady();
if (!isReady) {
setTimeout(function() {
getFriendList();
}, 200);
return;
}
uni.$chat.getFriendList().then((rs) => {
if (rs.code == 0) {
const result = rs.data;
userList.push(...result);
}
});
}
function open(item) {
Object.assign(videoItem, item);
proxy.$refs.firend.open();
}
function close() {
proxy.$refs.firend.close();
}
function handleShare(item) {
api.video.videoShare({
query: {
// 视频id
videoId: videoItem.videoId,
// 分享人id
sharedUserIds: item.userID
}
}).then((rs) => {
if (rs.code == 200) {
util$1.alert("分享成功");
close();
return;
}
util$1.alert({
content: rs.msg,
showCancel: false
});
});
}
__expose({
open,
close
});
const __returned__ = { proxy, userList, videoItem, userinfo, getFriendList, open, close, handleShare, onMounted, ref, reactive, getCurrentInstance, watch, computed, onBeforeUnmount, get util() {
return util$1;
}, get api() {
return api;
} };
Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
return __returned__;
}
};
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
const _component_uni_icons = resolveEasycom(resolveDynamicComponent("uni-icons"), __easycom_0);
const _component_uni_popup = resolveEasycom(resolveDynamicComponent("uni-popup"), __easycom_1$1);
return openBlock(), createElementBlock(
Fragment,
null,
[
createCommentVNode(" 分享给朋友 "),
createVNode(
_component_uni_popup,
{
ref: "firend",
type: "bottom"
},
{
default: withCtx(() => [
createElementVNode("view", { class: "shareBox popBot df fdc plr20 bfff" }, [
createElementVNode("view", { class: "header rows fdr" }, [
createElementVNode("view", { class: "title mt40" }, [
createElementVNode("u-text", { class: "f40" }, "分享给朋友")
]),
createElementVNode("view", {
class: "close",
onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$refs.firend.close())
}, [
createVNode(_component_uni_icons, {
type: "close",
size: "36rpx",
color: "#333"
})
])
]),
createElementVNode("view", { class: "firendBox f1 df fdc mb30" }, [
createElementVNode("scroll-view", {
scrollY: "true",
class: "scroll f1",
showScrollbar: false
}, [
$setup.userList[0] ? (openBlock(), createElementBlock("view", {
key: 0,
class: "list df fdr"
}, [
(openBlock(true), createElementBlock(
Fragment,
null,
renderList($setup.userList, (item, index) => {
return openBlock(), createElementBlock("view", {
class: "item aic",
key: index,
onClick: ($event) => $setup.handleShare(item)
}, [
createElementVNode("u-image", {
class: "wh100 cir",
src: item.profile.avatar,
mode: "aspectFill"
}, null, 8, ["src"]),
createElementVNode("view", { class: "txt mt10" }, [
createElementVNode(
"u-text",
{ class: "c111 f24" },
toDisplayString(item.profile.nick),
1
/* TEXT */
)
])
], 8, ["onClick"]);
}),
128
/* KEYED_FRAGMENT */
))
])) : (openBlock(), createElementBlock("view", {
key: 1,
class: "nomore"
}, [
createElementVNode("u-text", { class: "nomore" }, "暂无好友~")
]))
])
])
])
]),
_: 1
/* STABLE */
},
512
/* NEED_PATCH */
)
],
2112
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
);
}
const shareFirendAlt = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["styles", [_style_0]], ["__file", "D:/document/九亿商城/jy/jiuyi2/components/index/shareFirend.vue"]]);
export {
__easycom_0 as _,
__easycom_1$1 as a,
api as b,
__easycom_1$2 as c,
collectAdd as d,
commentAlt as e,
collectAlt as f,
shareFirendAlt as g,
indexVideo as i,
statusBar as s,
util$1 as u,
video as v
};