|
@@ -4,7 +4,7 @@
|
|
|
<span
|
|
|
@click="
|
|
|
() => {
|
|
|
- emit('close');
|
|
|
+ $emit('close');
|
|
|
}
|
|
|
"
|
|
|
class="close-text"
|
|
@@ -47,184 +47,200 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import composeTopicsMaskList from './composeTopicsMaskList.vue'
|
|
|
+import composeTopicsMaskList from "./composeTopicsMaskList.vue";
|
|
|
+import utils from "@/utils/index";
|
|
|
+import api from "@/api/index";
|
|
|
export default {
|
|
|
- // setup(props, { emit }) {
|
|
|
- // let mid = ref(null);
|
|
|
- // const store = useStore();
|
|
|
- // let randComlist = ref([]);
|
|
|
- // let randComlistIndex = ref(0);
|
|
|
- // let randSingleListList = ref(0);
|
|
|
- // let randSingleList = ref([]);
|
|
|
- // let type = store.state.lightConfig.type as number;
|
|
|
- // let directives = store.state.lightConfig.directives;
|
|
|
- // let newComList: lightingCombinationListResRow[];
|
|
|
- // // onMounted(() => {
|
|
|
- // // console.log(mid.value,"xx");
|
|
|
- // // });
|
|
|
- // let stopTopicsAudio = () => {
|
|
|
- // if (mid) {
|
|
|
- // console.log(mid);
|
|
|
- // mid.value.pauseAudioLoop();
|
|
|
+ // setup(props, { emit }) {
|
|
|
+ // let mid = ref(null);
|
|
|
+ // const store = useStore();
|
|
|
+ // let randComlist = ref([]);
|
|
|
+ // let randComlistIndex = ref(0);
|
|
|
+ // let randSingleListList = ref(0);
|
|
|
+ // let randSingleList = ref([]);
|
|
|
+ // let type = store.state.lightConfig.type as number;
|
|
|
+ // let directives = store.state.lightConfig.directives;
|
|
|
+ // let newComList: lightingCombinationListResRow[];
|
|
|
+ // // onMounted(() => {
|
|
|
+ // // console.log(mid.value,"xx");
|
|
|
+ // // });
|
|
|
+ // let stopTopicsAudio = () => {
|
|
|
+ // if (mid) {
|
|
|
+ // console.log(mid);
|
|
|
+ // mid.value.pauseAudioLoop();
|
|
|
|
|
|
- // mid.value.listIndex = -1;
|
|
|
- // }
|
|
|
- // };
|
|
|
- // const nextGroup = () => {
|
|
|
- // if (type == 0) {
|
|
|
- // let copySingleList = [...props.singleList]
|
|
|
- // randComlistIndex.value = randComlistIndex.value + 1;
|
|
|
- // let arrEnd = copySingleList.pop();
|
|
|
- // let arrBegin = copySingleList.shift();
|
|
|
- // let arr = copySingleList.sort((a, b) => Math.random() - 0.5);
|
|
|
- // let arrMid = arr.slice(0, directives);
|
|
|
- // randSingleList.value = [arrBegin, ...arrMid, arrEnd];
|
|
|
- // } else {
|
|
|
- // if (randComlistIndex.value + 1 >= props.comList.length) {
|
|
|
- // randComlistIndex.value = 0;
|
|
|
- // } else {
|
|
|
- // randComlistIndex.value = randComlistIndex.value + 1;
|
|
|
- // }
|
|
|
- // lightingCombinationId(newComList[randComlistIndex.value].id).then((res) => {
|
|
|
- // randComlist.value = res.data;
|
|
|
- // });
|
|
|
- // }
|
|
|
- // };
|
|
|
- // watch(
|
|
|
- // () => props.comList,
|
|
|
- // (val, oldValue) => {
|
|
|
- // if (type == 1) {
|
|
|
- // console.log("辩护了");
|
|
|
- // let arr = val?.sort((a, b) => Math.random() - 0.5);
|
|
|
- // newComList = arr;
|
|
|
- // if (arr && arr.length > 0) {
|
|
|
- // lightingCombinationId(arr[randComlistIndex.value].id).then((res) => {
|
|
|
- // randComlist.value = res.data;
|
|
|
- // });
|
|
|
- // }
|
|
|
- // }
|
|
|
+ // mid.value.listIndex = -1;
|
|
|
+ // }
|
|
|
+ // };
|
|
|
+ // const nextGroup = () => {
|
|
|
+ // if (type == 0) {
|
|
|
+ // let copySingleList = [...props.singleList]
|
|
|
+ // randComlistIndex.value = randComlistIndex.value + 1;
|
|
|
+ // let arrEnd = copySingleList.pop();
|
|
|
+ // let arrBegin = copySingleList.shift();
|
|
|
+ // let arr = copySingleList.sort((a, b) => Math.random() - 0.5);
|
|
|
+ // let arrMid = arr.slice(0, directives);
|
|
|
+ // randSingleList.value = [arrBegin, ...arrMid, arrEnd];
|
|
|
+ // } else {
|
|
|
+ // if (randComlistIndex.value + 1 >= props.comList.length) {
|
|
|
+ // randComlistIndex.value = 0;
|
|
|
+ // } else {
|
|
|
+ // randComlistIndex.value = randComlistIndex.value + 1;
|
|
|
+ // }
|
|
|
+ // lightingCombinationId(newComList[randComlistIndex.value].id).then((res) => {
|
|
|
+ // randComlist.value = res.data;
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ // };
|
|
|
+ // watch(
|
|
|
+ // () => props.comList,
|
|
|
+ // (val, oldValue) => {
|
|
|
+ // if (type == 1) {
|
|
|
+ // console.log("辩护了");
|
|
|
+ // let arr = val?.sort((a, b) => Math.random() - 0.5);
|
|
|
+ // newComList = arr;
|
|
|
+ // if (arr && arr.length > 0) {
|
|
|
+ // lightingCombinationId(arr[randComlistIndex.value].id).then((res) => {
|
|
|
+ // randComlist.value = res.data;
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ // }
|
|
|
|
|
|
- // /* ... */
|
|
|
- // },
|
|
|
- // {
|
|
|
- // immediate: true,
|
|
|
- // }
|
|
|
- // );
|
|
|
+ // /* ... */
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // immediate: true,
|
|
|
+ // }
|
|
|
+ // );
|
|
|
|
|
|
- // watch(
|
|
|
- // () => props.singleList,
|
|
|
- // (val, oldValue) => {
|
|
|
- // if (type == 0) {
|
|
|
- // let copyVal = [...val]
|
|
|
- // let arrEnd = copyVal.pop();
|
|
|
- // let arrBegin =copyVal.shift();
|
|
|
- // let arr = [...copyVal].sort((a, b) => Math.random() - 0.5);
|
|
|
- // let arrMid = arr.slice(0, directives);
|
|
|
- // arr = [arrBegin, ...arrMid, arrEnd];
|
|
|
- // randSingleList.value = arr
|
|
|
- // }
|
|
|
+ // watch(
|
|
|
+ // () => props.singleList,
|
|
|
+ // (val, oldValue) => {
|
|
|
+ // if (type == 0) {
|
|
|
+ // let copyVal = [...val]
|
|
|
+ // let arrEnd = copyVal.pop();
|
|
|
+ // let arrBegin =copyVal.shift();
|
|
|
+ // let arr = [...copyVal].sort((a, b) => Math.random() - 0.5);
|
|
|
+ // let arrMid = arr.slice(0, directives);
|
|
|
+ // arr = [arrBegin, ...arrMid, arrEnd];
|
|
|
+ // randSingleList.value = arr
|
|
|
+ // }
|
|
|
|
|
|
- // /* ... */
|
|
|
- // },
|
|
|
- // {
|
|
|
- // immediate: true,
|
|
|
- // }
|
|
|
- // );
|
|
|
+ // /* ... */
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // immediate: true,
|
|
|
+ // }
|
|
|
+ // );
|
|
|
|
|
|
- // return {
|
|
|
- // nextGroup,
|
|
|
- // randSingleListList,
|
|
|
- // randSingleList,
|
|
|
- // emit,
|
|
|
- // randComlistIndex,
|
|
|
- // props,
|
|
|
- // randComlist,
|
|
|
- // store,
|
|
|
- // type,
|
|
|
- // mid,
|
|
|
- // directives,
|
|
|
- // stopTopicsAudio,
|
|
|
- // };
|
|
|
- // },
|
|
|
- data() {
|
|
|
- return {
|
|
|
- randComlist:[],
|
|
|
- randComlistIndex:0,
|
|
|
- randSingleListList:0,
|
|
|
- randSingleList:[]
|
|
|
+ // return {
|
|
|
+ // nextGroup,
|
|
|
+ // randSingleListList,
|
|
|
+ // randSingleList,
|
|
|
+ // emit,
|
|
|
+ // randComlistIndex,
|
|
|
+ // props,
|
|
|
+ // randComlist,
|
|
|
+ // store,
|
|
|
+ // type,
|
|
|
+ // mid,
|
|
|
+ // directives,
|
|
|
+ // stopTopicsAudio,
|
|
|
+ // };
|
|
|
+ // },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ randComlist: [],
|
|
|
+ randSingleList: [],
|
|
|
+ randComlistIndex: 0,
|
|
|
+ randSingleListList: 0,
|
|
|
+ newComList: [],
|
|
|
+ audio: {},
|
|
|
+ type: Number(this.$store.state.user.lightConfig.type),
|
|
|
+ directives: Number(this.$store.state.user.lightConfig.directives),
|
|
|
+ };
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ stopTopicsAudio: () => {
|
|
|
+ audio.pause();
|
|
|
+ },
|
|
|
+ createRandSingleList() {
|
|
|
+ let directives = this.$store.state.user.lightConfig.directives;
|
|
|
+ let singleList = [...this.singleList];
|
|
|
+ let end = singleList.pop();
|
|
|
+ let start = singleList.shift();
|
|
|
+ let mid = singleList.sort((a, b) => Math.random() - 0.5);
|
|
|
+ return [start, ...mid.slice(0, directives), end];
|
|
|
+ },
|
|
|
+ nextGroup() {
|
|
|
+ if (this.$store.state.user.lightConfig.type == 0) {
|
|
|
+ this.randSingleList = this.createRandSingleList();
|
|
|
+ } else {
|
|
|
+ if (this.randComlistIndex + 1 >= this.comList.length) {
|
|
|
+ this.randComlistIndex = 0;
|
|
|
+ } else {
|
|
|
+ this.randComlistIndex = this.randComlistIndex + 1;
|
|
|
+ }
|
|
|
|
|
|
+ api.open
|
|
|
+ .lightingCombinationId(this.newComList[this.randComlistIndex].id)
|
|
|
+ .then((res) => {
|
|
|
+ this.randComlist = res.data;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ },
|
|
|
+ props: {
|
|
|
+ show: {
|
|
|
+ type: Boolean,
|
|
|
+ default: false,
|
|
|
+ },
|
|
|
+ title: {
|
|
|
+ type: String,
|
|
|
+ default: "",
|
|
|
+ },
|
|
|
+ comList: {
|
|
|
+ type: Array,
|
|
|
+ default: () => {
|
|
|
+ return [];
|
|
|
+ },
|
|
|
+ },
|
|
|
+ singleList: {
|
|
|
+ type: Array,
|
|
|
+ default: () => {
|
|
|
+ return [];
|
|
|
+ },
|
|
|
+ },
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ comTitle() {
|
|
|
+ if (
|
|
|
+ this.comList &&
|
|
|
+ this.comList.length > 0 &&
|
|
|
+ this.randComlistIndex < this.comList.length
|
|
|
+ ) {
|
|
|
+ return this.comList[this.randComlistIndex].titile;
|
|
|
+ } else {
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+ },
|
|
|
|
|
|
- }
|
|
|
- },
|
|
|
- methods: {
|
|
|
- stopTopicsAudio:() => {
|
|
|
- if (mid) {
|
|
|
- console.log(mid);
|
|
|
- mid.value.pauseAudioLoop();
|
|
|
-
|
|
|
- mid.value.listIndex = -1;
|
|
|
- }
|
|
|
- },
|
|
|
- nextGroup :() => {
|
|
|
- if (type == 0) {
|
|
|
- let copySingleList = [...props.singleList]
|
|
|
- randComlistIndex.value = randComlistIndex.value + 1;
|
|
|
- let arrEnd = copySingleList.pop();
|
|
|
- let arrBegin = copySingleList.shift();
|
|
|
- let arr = copySingleList.sort((a, b) => Math.random() - 0.5);
|
|
|
- let arrMid = arr.slice(0, directives);
|
|
|
- randSingleList.value = [arrBegin, ...arrMid, arrEnd];
|
|
|
- } else {
|
|
|
- if (randComlistIndex.value + 1 >= props.comList.length) {
|
|
|
- randComlistIndex.value = 0;
|
|
|
- } else {
|
|
|
- randComlistIndex.value = randComlistIndex.value + 1;
|
|
|
- }
|
|
|
- lightingCombinationId(newComList[randComlistIndex.value].id).then((res) => {
|
|
|
- randComlist.value = res.data;
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- props: {
|
|
|
- show: {
|
|
|
- type: Boolean,
|
|
|
- default: false,
|
|
|
- },
|
|
|
- title: {
|
|
|
- type: String,
|
|
|
- default: "",
|
|
|
- },
|
|
|
- comList: {
|
|
|
- type: Array,
|
|
|
- default: () => {
|
|
|
- return [];
|
|
|
- },
|
|
|
- },
|
|
|
- singleList: {
|
|
|
- type: Array,
|
|
|
- default: () => {
|
|
|
- return [];
|
|
|
- },
|
|
|
- },
|
|
|
- },
|
|
|
- computed: {
|
|
|
- comTitle() {
|
|
|
- if (this.comList && this.comList.length > 0 && this.randComlistIndex < this.comList.length) {
|
|
|
- return this.comList[this.randComlistIndex].titile;
|
|
|
- } else {
|
|
|
- return "";
|
|
|
- }
|
|
|
- },
|
|
|
- // randComList():lightingCombinationListResRow[]{
|
|
|
- // let arr = this.comList.sort((a, b) => Math.random() - 0.5);
|
|
|
- // return arr
|
|
|
- // }
|
|
|
- },
|
|
|
- components: {
|
|
|
- composeTopicsMaskList,
|
|
|
- },
|
|
|
- mounted() {},
|
|
|
+ // randComList():lightingCombinationListResRow[]{
|
|
|
+ // let arr = this.comList.sort((a, b) => Math.random() - 0.5);
|
|
|
+ // return arr
|
|
|
+ // }
|
|
|
+ },
|
|
|
+ components: {
|
|
|
+ composeTopicsMaskList,
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ this.audio = utils.wxUtils.getGlobAudio();
|
|
|
+ this.randSingleList = this.createRandSingleList();
|
|
|
+ this.newComList = this.comList.sort((a, b) => Math.random() - 0.5);
|
|
|
+ api.open.lightingCombinationId(this.newComList[0].id).then((res) => {
|
|
|
+ this.randComlist = res.data;
|
|
|
+ });
|
|
|
+ },
|
|
|
};
|
|
|
</script>
|
|
|
|