调整工程目录

This commit is contained in:
aixianling
2021-12-15 14:37:20 +08:00
parent 76b0abe1ea
commit dd1aef6fb3
107 changed files with 17044 additions and 16746 deletions

View File

@@ -7,63 +7,62 @@
</template>
<script>
export default {
name: "AiAdd",
props: {
},
data() {
return {}
},
methods: {
add() {
this.$emit("add")
}
export default {
name: "AiAdd",
props: {},
data() {
return {}
},
methods: {
add() {
this.$emit("add")
}
}
}
</script>
<style lang="scss" scoped>
.movableArea {
position: fixed;
left: 0;
top: 0;
width: 100%;
height: 100%;
pointer-events: none;
z-index: 999;
.movableArea {
position: fixed;
left: 0;
top: 0;
width: 100%;
height: 100%;
pointer-events: none;
z-index: 999;
uni-movable-view {
pointer-events: auto;
}
uni-movable-view {
pointer-events: auto;
}
}
.AiAdd {
width: 96px;
height: 96px;
background: #1365DD;
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
border-radius: 50%;
display: flex;
align-items: center;
flex-direction: column;
justify-content: center;
&:before, &:after {
content: "";
background: #FFFFFF;
display: block;
position: absolute;
border-radius: 4px;
}
.AiAdd {
width: 96px;
height: 96px;
background: #1365DD;
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
border-radius: 50%;
display: flex;
align-items: center;
flex-direction: column;
justify-content: center;
&:before , &:after{
content: "";
background: #FFFFFF;
display: block;
position: absolute;
border-radius: 4px;
}
&:before{
height: 48px;
width: 4px;
}
&:after{
height: 4px;
width: 48px;
}
&:before {
height: 48px;
width: 4px;
}
&:after {
height: 4px;
width: 48px;
}
}
</style>

View File

@@ -2,21 +2,22 @@
<section class="AiAreaPicker">
<ai-search-popup mode="bottom" ref="areaSelector">
<div slot="btn" @tap="handleInit">
<slot v-if="$slots.default" />
<slot v-if="$slots.default"/>
<div v-else class="areaSelector">
<image :src="icon" class="location" />
<div v-text="currentArea.name" />
<image :src="icon" class="location"/>
<div v-text="currentArea.name"/>
</div>
</div>
<div class="areaSelector">
<div class="fixedTop">
<span v-for="(area, i) in fullArea" :key="area.id" v-text="area.name" :class="{ current: area.id == index }" @click="selectNode(area, i)" />
<span v-for="(area, i) in fullArea" :key="area.id" v-text="area.name" :class="{ current: area.id == index }"
@click="selectNode(area, i)"/>
</div>
<span v-text="currentArea.name" />
<span v-text="currentArea.name"/>
</div>
<div class="pendingItem flexRow" flex v-for="op in list" :key="op.id">
<div class="fill" :class="{ self: index == op.id }" v-html="op.name" @tap="handleSelect(op)" />
<u-icon v-if="index != op.id" name="arrow-right" color="#ddd" @click="getChild(op)" />
<div class="fill" :class="{ self: index == op.id }" v-html="op.name" @tap="handleSelect(op)"/>
<u-icon v-if="index != op.id" name="arrow-right" color="#ddd" @click="getChild(op)"/>
</div>
</ai-search-popup>
</section>
@@ -25,21 +26,21 @@
<script>
import AiSearchPopup from './AiSearchPopup'
import AiCell from './AiCell.vue'
import { mapState } from 'vuex'
import {mapState} from 'vuex'
export default {
name: 'AiAreaPicker',
components: { AiCell, AiSearchPopup },
components: {AiCell, AiSearchPopup},
props: {
areaId: { default: '' },
name: { default: '' },
areaId: {default: ''},
name: {default: ''},
all: Boolean,
},
computed: {
...mapState(['user']),
dataRange() {
let rules = [10, 8, 6, 3, 0],
level = 0
level = 0
if (this.all) return (level = 0)
rules.some((e, i) => {
let reg = new RegExp(`0{${e}}`, 'g')
@@ -58,7 +59,7 @@ export default {
},
data() {
return {
fullArea: [{ name: '全国', id: 0 }],
fullArea: [{name: '全国', id: 0}],
index: '',
list: [],
}
@@ -72,39 +73,39 @@ export default {
getFullArea() {
let areaId = this.areaId || (this.all ? '' : this.$areaId)
areaId &&
this.$http
.post('/admin/area/getAllParentAreaId', null, {
withoutToken: true,
params: { areaId },
})
.then((res) => {
if (res?.data) {
if (res.data.length > 1) {
this.fullArea = res.data.reverse().slice(this.dataRange)
} else {
this.fullArea = res.data
}
this.fullArea.unshift({ name: '全国', id: 0 })
}
})
this.$http
.post('/admin/area/getAllParentAreaId', null, {
withoutToken: true,
params: {areaId},
})
.then((res) => {
if (res?.data) {
if (res.data.length > 1) {
this.fullArea = res.data.reverse().slice(this.dataRange)
} else {
this.fullArea = res.data
}
this.fullArea.unshift({name: '全国', id: 0})
}
})
},
getChildAreas(id) {
id &&
this.$http
.post('/admin/area/queryAreaByParentId', null, {
withoutToken: true,
params: { id },
})
.then((res) => {
if (res?.data) {
this.list = res.data
let self = this.fullArea.find((e) => e.id == this.index)
this.list.unshift(self)
}
})
this.$http
.post('/admin/area/queryAreaByParentId', null, {
withoutToken: true,
params: {id},
})
.then((res) => {
if (res?.data) {
this.list = res.data
let self = this.fullArea.find((e) => e.id == this.index)
this.list.unshift(self)
}
})
},
getProvinces() {
this.$http.post('/admin/area/queryProvinceList', null, { withoutToken: true }).then((res) => {
this.$http.post('/admin/area/queryProvinceList', null, {withoutToken: true}).then((res) => {
if (res?.data) {
this.list = res.data
}

View File

@@ -26,13 +26,13 @@ export default {
justify-content: center;
.emptyImg {
width: 400 rpx;
height: 240 rpx;
width: 400px;
height: 240px;
margin-top: 112px;
}
.emptyText {
font-size: 29 rpx;
font-size: 29px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: rgba(183, 183, 183, 1);

View File

@@ -45,7 +45,7 @@ export default {
current: this.image,
urls: [this.image],
success() {
sessionStorage.setItem("previewImage"," 1")
sessionStorage.setItem("previewImage", " 1")
}
})
} else {

View File

@@ -12,137 +12,137 @@
</template>
<script>
import tree from "./AiSelectEnterprise/tree";
import AiBack from "./AiBack";
import tree from "./AiSelectEnterprise/tree";
import AiBack from "./AiBack";
export default {
name: "AiSelectEnterprise",
components: {tree, AiBack},
props: {
value: {
type: Array,
default: () => []
},
multiple: {
type: Boolean,
default: true
},
rootId: Object,
export default {
name: "AiSelectEnterprise",
components: {tree, AiBack},
props: {
value: {
type: Array,
default: () => []
},
data() {
return {
tree: [],
checkList: this.value,
prop: {
label: 'name',
multiple: this.multiple,
},
map: {},
multiple: {
type: Boolean,
default: true
},
rootId: Object,
},
data() {
return {
tree: [],
checkList: this.value,
prop: {
label: 'name',
multiple: this.multiple,
},
map: {},
}
},
created() {
uni.pageScrollTo({
duration: 0,
scrollTop: 0
})
},
methods: {
confirm() {
let filter = []
this.map = {}
this.recursion(this.checkList)
Object.keys(this.map).map(e => filter.push(this.map[e]))
this.$emit("change", filter)
this.$emit('update:visible', false)
},
recursion(arr) {
if (arr?.length) {
arr.map(e => {
if ((e.type == 0 || e.openId) && e.checked && !this.map[e.id]) {
this.map[e.id] = e
this.recursion(e.childrenUser)
}
if (e.childrenDept?.length) {
this.recursion(e.childrenDept)
}
})
}
},
created() {
uni.pageScrollTo({
duration: 0,
scrollTop: 0
})
},
methods: {
confirm() {
let filter = []
this.map = {}
this.recursion(this.checkList)
Object.keys(this.map).map(e => filter.push(this.map[e]))
this.$emit("change", filter)
this.$emit('update:visible', false)
},
recursion(arr) {
if (arr?.length) {
arr.map(e => {
if ((e.type == 0 || e.openId) && e.checked && !this.map[e.id]) {
this.map[e.id] = e
this.recursion(e.childrenUser)
}
if (e.childrenDept?.length) {
this.recursion(e.childrenDept)
}
})
}
}
},
}
}
},
}
</script>
<style lang="scss" scoped>
.AiSelectEnterprise {
min-height: 100%;
background-color: #F5F5F5;
position: relative;
.AiSelectEnterprise {
min-height: 100%;
background-color: #F5F5F5;
position: relative;
.footer {
width: 100%;
display: flex;
align-items: center;
z-index: 10;
background: #F4F8FB;
position: fixed;
left: 0;
bottom: 0;
box-sizing: border-box;
padding: 0 32px;
.footer {
width: 100%;
display: flex;
align-items: center;
z-index: 10;
background: #F4F8FB;
position: fixed;
left: 0;
bottom: 0;
box-sizing: border-box;
padding: 0 32px;
.scroll {
height: 118px;
.scroll {
height: 118px;
::v-deep .uni-scroll-view-content {
::v-deep .uni-scroll-view-content {
display: flex;
align-items: center;
.tag {
width: 236px;
height: 72px;
background: #EAEEF1;
border-radius: 8px;
display: flex;
align-items: center;
margin-right: 16px;
.tag {
width: 236px;
height: 72px;
background: #EAEEF1;
border-radius: 8px;
display: flex;
align-items: center;
margin-right: 16px;
& > img {
width: 48px;
height: 45px;
margin-right: 8px;
flex-shrink: 0;
}
& > img {
width: 48px;
height: 45px;
margin-right: 8px;
flex-shrink: 0;
}
& > label {
width: 148px;
height: 42px;
font-size: 30px;
font-weight: 600;
color: #333333;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
& > label {
width: 148px;
height: 42px;
font-size: 30px;
font-weight: 600;
color: #333333;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
}
}
.btn {
width: 192px;
height: 80px;
background: #1365DD;
border-radius: 4px;
z-index: 10;
display: flex;
align-items: center;
justify-content: center;
font-size: 32px;
color: #FFFFFF;
margin-left: 8px;
}
.btn {
width: 192px;
height: 80px;
background: #1365DD;
border-radius: 4px;
z-index: 10;
display: flex;
align-items: center;
justify-content: center;
font-size: 32px;
color: #FFFFFF;
margin-left: 8px;
}
}
}
</style>

View File

@@ -24,10 +24,10 @@
<div class="inline-item" @click.stop="backTree(item,index)" v-if="index!=0">
<span style="margin: 0 8px">/</span>
<text v-if="index==parent.length-1" class="none inline-item">
{{item[tag]}}
{{ item[tag] }}
</text>
<text v-else class="active">
{{item[tag]}}
{{ item[tag] }}
</text>
</div>
</div>
@@ -50,17 +50,17 @@
<u-row justify="between" style="width: 100%;">
<div class="word" v-if="tag=='name'">
<img :src="$cdn + 'common/xzbq.png'" v-if="item.type==1" alt="">
<span class="ellipsis">{{item[tag]}}</span>
<span class="ellipsis">{{ item[tag] }}</span>
</div>
<div class="word" v-else-if="tag=='tagname'">
<template v-if="!item.openId">
<img :src="$cdn + 'common/xzbqbottom.png'" alt="">
<span class="ellipsis">{{item[tag]}}</span>
<span class="ellipsis">{{ item[tag] }}</span>
</template>
<template v-else>
<u-avatar :src="item.avatar || ($cdn + 'common/xztx.png')" mode="square" :size="37"
style="margin: 0 17px;"></u-avatar>
<span class="ellipsis">{{item["name"]}}</span>
<span class="ellipsis">{{ item["name"] }}</span>
</template>
</div>
<div class="right"
@@ -75,61 +75,119 @@
</template>
<script>
import AiTopFixed from "../AiTopFixed";
import AiTopFixed from "../AiTopFixed";
export default {
name: "tree",
components: {AiTopFixed},
props: {
checkList: {
type: Array,
default: () => []
},
searchIf: {
type: Boolean,
default: () => true
},
multiple: {
type: Boolean,
default: true
},
rootId: Object,
export default {
name: "tree",
components: {AiTopFixed},
props: {
checkList: {
type: Array,
default: () => []
},
data() {
return {
isSear: false,
tree: [],
parent: [1],
searchResult: [],
allData: [],
newCheckList: this.checkList,
scrollLeft: Infinity,
keyword: "",
current: 0,
tag: "name",
searchIf: {
type: Boolean,
default: () => true
},
multiple: {
type: Boolean,
default: true
},
rootId: Object,
},
data() {
return {
isSear: false,
tree: [],
parent: [1],
searchResult: [],
allData: [],
newCheckList: this.checkList,
scrollLeft: Infinity,
keyword: "",
current: 0,
tag: "name",
}
},
methods: {
tabChange(e) {
this.tag = e == 0 ? "name" : "tagname"
this.current = e
this.parent = [1]
// this.newCheckList = []
this.getTree()
},
clear() {
this.keyword = ""
this.tree = this.allData
this.parent = [1]
this.isSear = false
},
checkboxChange(item, index) {
if (item.checked) {
this.$set(this.tree[index], 'checked', false)
this.delChild(item)
for (let index = 0, n = this.newCheckList.length; index < n; index++) {
let temp = this.newCheckList[index];
if (temp.id == item.id) {
this.newCheckList.splice(index, 1)
break
}
}
} else {
(item.type == 0 || item.openId) && this.newCheckList.push(item)
this.$set(this.tree[index], 'checked', true)
this.chooseChild(item)
}
this.$emit('sendValue', this.newCheckList)
},
delUser(id) {
for (let i = 0, len = this.newCheckList.length; i < len; i++) {
if (this.newCheckList[i].id === id) {
return this.newCheckList.splice(i, 1)
}
}
},
methods: {
tabChange(e) {
this.tag = e == 0 ? "name" : "tagname"
this.current = e
this.parent = [1]
// this.newCheckList = []
this.getTree()
},
chooseChild(arr) {
if (arr.childrenDept?.length) {
for (let i = 0, len = arr.childrenDept.length; i < len; i++) {
let item = arr.childrenDept[i]
item.checked = true
this.newCheckList.push(item)
this.chooseChild(item)
}
}
clear() {
this.keyword = ""
this.tree = this.allData
this.parent = [1]
this.isSear = false
},
if (arr.childrenUser?.length) {
for (let i = 0, len = arr.childrenUser.length; i < len; i++) {
let item = arr.childrenUser[i]
item.checked = true
this.newCheckList.push(item)
this.chooseChild(item)
}
}
checkboxChange(item, index) {
if (item.checked) {
this.$set(this.tree[index], 'checked', false)
this.delChild(item)
if (arr.users?.length) {
for (let i = 0, len = arr.users.length; i < len; i++) {
let item = arr.users[i]
item.checked = true
this.newCheckList.push(item)
this.chooseChild(item)
}
}
this.newCheckList = Array.from(new Set(this.newCheckList))
},
delChild(arr) {
if (arr.childrenDept?.length) {
for (let i = 0, len = arr.childrenDept.length; i < len; i++) {
let item = arr.childrenDept[i];
item.checked = false
for (let index = 0, n = this.newCheckList.length; index < n; index++) {
let temp = this.newCheckList[index];
if (temp.id == item.id) {
@@ -137,345 +195,287 @@
break
}
}
} else {
(item.type == 0 || item.openId) && this.newCheckList.push(item)
this.$set(this.tree[index], 'checked', true)
this.chooseChild(item)
this.delChild(item)
}
this.$emit('sendValue', this.newCheckList)
},
}
delUser(id) {
for (let i = 0, len = this.newCheckList.length; i < len; i++) {
if (this.newCheckList[i].id === id) {
return this.newCheckList.splice(i, 1)
if (arr.childrenUser?.length) {
for (let i = 0, len = arr.childrenUser.length; i < len; i++) {
let item = arr.childrenUser[i];
item.checked = false
for (let index = 0, n = this.newCheckList.length; index < n; index++) {
let temp = this.newCheckList[index];
if (temp.id == item.id) {
this.newCheckList.splice(index, 1)
break
}
}
this.delChild(item)
}
},
}
},
chooseChild(arr) {
if (arr.childrenDept?.length) {
for (let i = 0, len = arr.childrenDept.length; i < len; i++) {
let item = arr.childrenDept[i]
item.checked = true
this.newCheckList.push(item)
this.chooseChild(item)
}
}
if (arr.childrenUser?.length) {
for (let i = 0, len = arr.childrenUser.length; i < len; i++) {
let item = arr.childrenUser[i]
item.checked = true
this.newCheckList.push(item)
this.chooseChild(item)
}
}
if (arr.users?.length) {
for (let i = 0, len = arr.users.length; i < len; i++) {
let item = arr.users[i]
item.checked = true
this.newCheckList.push(item)
this.chooseChild(item)
}
}
this.newCheckList = Array.from(new Set(this.newCheckList))
},
delChild(arr) {
if (arr.childrenDept?.length) {
for (let i = 0, len = arr.childrenDept.length; i < len; i++) {
let item = arr.childrenDept[i];
//单选
checkbox(item, index) {
let status = !this.tree[index].checked
this.$set(this.tree[index], 'checked', status)
if (this.newCheckList.length <= 0) {
this.newCheckList = [this.tree[index]]
} else if (this.newCheckList.length == 1) {
this.tree.forEach(item => {
if (item.id != this.tree[index].id) {
item.checked = false
for (let index = 0, n = this.newCheckList.length; index < n; index++) {
let temp = this.newCheckList[index];
if (temp.id == item.id) {
this.newCheckList.splice(index, 1)
break
}
}
this.delChild(item)
}
})
this.newCheckList = []
if (this.tree[index].checked) {
this.newCheckList.push(this.tree[index])
}
}
this.$emit('sendValue', this.newCheckList)
},
if (arr.childrenUser?.length) {
for (let i = 0, len = arr.childrenUser.length; i < len; i++) {
let item = arr.childrenUser[i];
item.checked = false
for (let index = 0, n = this.newCheckList.length; index < n; index++) {
let temp = this.newCheckList[index];
if (temp.id == item.id) {
this.newCheckList.splice(index, 1)
break
}
}
this.delChild(item)
toNext(item) {
if (this.tag == "name") {
if (item.type == 1 && (item["childrenDept"].length || item["childrenUser"].length)) {
this.tree = []
if (item["childrenDept"].length) {
this.tree = item["childrenDept"]
}
}
},
//单选
checkbox(item, index) {
let status = !this.tree[index].checked
this.$set(this.tree[index], 'checked', status)
if (this.newCheckList.length <= 0) {
this.newCheckList = [this.tree[index]]
} else if (this.newCheckList.length == 1) {
this.tree.forEach(item => {
if (item.id != this.tree[index].id) {
item.checked = false
}
})
this.newCheckList = []
if (this.tree[index].checked) {
this.newCheckList.push(this.tree[index])
if (item["childrenUser"].length) {
this.tree = [...this.tree, ...item["childrenUser"]]
}
}
this.$emit('sendValue', this.newCheckList)
},
toNext(item) {
if (this.tag == "name") {
if (item.type == 1 && (item["childrenDept"].length || item["childrenUser"].length)) {
this.tree = []
if (item["childrenDept"].length) {
this.tree = item["childrenDept"]
}
if (item["childrenUser"].length) {
this.tree = [...this.tree, ...item["childrenUser"]]
}
this.checkIf()
if (this.parent[0].id !== item.id) {
this.parent.push(item)
}
}
} else if (this.tag == "tagname" && !item.openId) {
this.tree = item.users
this.checkIf()
if (this.parent[0].id !== item.id) {
this.parent.push(item)
}
}
this.$nextTick(() => {
this.scrollLeft += 200
})
},
checkIf() {
for (let i = 0, len = this.tree.length; i < len; i++) {
for (let j = 0, lens = this.newCheckList.length; j < lens; j++) {
if (this.newCheckList[j].id == this.tree[i].id) {
this.$set(this.tree[i], 'checked', true)
break
} else {
this.$set(this.tree[i], 'checked', false)
}
}
} else if (this.tag == "tagname" && !item.openId) {
this.tree = item.users
if (this.parent[0].id !== item.id) {
this.parent.push(item)
}
},
}
confirmSearch(val) {
this.searchResult = []
this.search(this.tree, val)
this.isSear = true
this.parent.splice(1, Infinity)
this.tree = this.searchResult
if(!val) this.clear()
},
search(data, keyword) {
if (data.length) {
for (let i = 0, len = data.length; i < len; i++) {
if (data[i].name?.indexOf(keyword) != -1) {
this.searchResult.push(data[i])
}
if (data[i]["childrenDept"]?.length || data[i]["childrenUser"]?.length) {
this.search(data[i]["childrenDept"].concat(data[i]["childrenUser"]), keyword)
}
if (data[i]["users"]?.length) {
this.search(data[i]["users"], keyword)
}
}
}
},
backTree(item, index) {
if (index == -1) {
this.tree = this.allData
this.parent.splice(1, Infinity)
this.isSear = false
this.keyword = ""
} else if (index == -2) {
this.tree = this.searchResult
this.parent.splice(1, Infinity)
} else {
if (this.parent.length - index > 2) {
this.parent.forEach((item, i) => {
if (i > index) {
this.parent.splice(i, Infinity)
}
})
} else if (index != this.parent.length - 1) {
this.parent.splice(this.parent.length - 1, 1)
}
this.tree = item["childrenDept"].concat(item["childrenUser"] || [])
}
if (this.multiple) return
this.checkIf()
},
getTree() {
this.$http.post(this.current == 0 ? "/app/wxcp/wxuser/tree" : "/app/wxcp/wxtag/tree", null, {
params: {
rootId: this.rootId
}
}).then(res => {
if (res && res.data) {
let result = this.tag == 'name' ? [res.data] : res.data
this.tree = result
this.allData = result
}
})
},
this.$nextTick(() => {
this.scrollLeft += 200
})
},
computed: {
list() {
return [
{name: "组织架构"},
{name: "标签"}
]
checkIf() {
for (let i = 0, len = this.tree.length; i < len; i++) {
for (let j = 0, lens = this.newCheckList.length; j < lens; j++) {
if (this.newCheckList[j].id == this.tree[i].id) {
this.$set(this.tree[i], 'checked', true)
break
} else {
this.$set(this.tree[i], 'checked', false)
}
}
}
},
created() {
this.getTree()
confirmSearch(val) {
this.searchResult = []
this.search(this.tree, val)
this.isSear = true
this.parent.splice(1, Infinity)
this.tree = this.searchResult
if (!val) this.clear()
},
search(data, keyword) {
if (data.length) {
for (let i = 0, len = data.length; i < len; i++) {
if (data[i].name?.indexOf(keyword) != -1) {
this.searchResult.push(data[i])
}
if (data[i]["childrenDept"]?.length || data[i]["childrenUser"]?.length) {
this.search(data[i]["childrenDept"].concat(data[i]["childrenUser"]), keyword)
}
if (data[i]["users"]?.length) {
this.search(data[i]["users"], keyword)
}
}
}
},
backTree(item, index) {
if (index == -1) {
this.tree = this.allData
this.parent.splice(1, Infinity)
this.isSear = false
this.keyword = ""
} else if (index == -2) {
this.tree = this.searchResult
this.parent.splice(1, Infinity)
} else {
if (this.parent.length - index > 2) {
this.parent.forEach((item, i) => {
if (i > index) {
this.parent.splice(i, Infinity)
}
})
} else if (index != this.parent.length - 1) {
this.parent.splice(this.parent.length - 1, 1)
}
this.tree = item["childrenDept"].concat(item["childrenUser"] || [])
}
if (this.multiple) return
this.checkIf()
},
getTree() {
this.$http.post(this.current == 0 ? "/app/wxcp/wxuser/tree" : "/app/wxcp/wxtag/tree", null, {
params: {
rootId: this.rootId
}
}).then(res => {
if (res && res.data) {
let result = this.tag == 'name' ? [res.data] : res.data
this.tree = result
this.allData = result
}
})
},
},
computed: {
list() {
return [
{name: "组织架构"},
{name: "标签"}
]
}
},
created() {
this.getTree()
}
}
</script>
<style lang="scss" scoped>
.tree {
min-height: 100%;
background-color: #F5F5F5;
.tree {
min-height: 100%;
background-color: #F5F5F5;
.top {
background-color: #FFFFFF;
}
.top {
background-color: #FFFFFF;
}
.tree-list {
margin-top: 24px;
background-color: #FFFFFF;
.tree-list {
margin-top: 24px;
background-color: #FFFFFF;
.scroll {
white-space: nowrap;
border-bottom: 1px solid #f4f4f4;
.scroll {
white-space: nowrap;
border-bottom: 1px solid #f4f4f4;
.inline-item {
height: 112px;
font-size: 30px;
display: inline-block;
line-height: 112px;
.inline-item {
height: 112px;
font-size: 30px;
display: inline-block;
line-height: 112px;
.active {
color: #4297ED !important;
font-weight: 600;
}
.active {
color: #4297ED !important;
font-weight: 600;
}
.none {
color: #666666;
font-weight: 600;
}
.none {
color: #666666;
font-weight: 600;
}
}
}
.container-list {
min-height: 1000px;
overflow-y: scroll;
overflow-x: hidden;
.container-list {
min-height: 1000px;
overflow-y: scroll;
overflow-x: hidden;
.common {
background-color: #fff;
border-bottom: 1px solid #f4f4f4;
box-sizing: border-box;
padding: 0 30px;
.common {
background-color: #fff;
border-bottom: 1px solid #f4f4f4;
box-sizing: border-box;
padding: 0 30px;
.content {
.content {
display: flex;
align-items: center;
height: 100px;
width: 100%;
line-height: 100px;
position: relative;
font-size: 32px;
.right {
width: 16px;
height: 16px;
border-right: 4px solid #CCCCCC;
border-top: 4px solid #CCCCCC;
transform: rotate(45deg);
}
.word {
display: flex;
align-items: center;
height: 100px;
width: 100%;
line-height: 100px;
position: relative;
font-size: 32px;
.right {
width: 16px;
height: 16px;
border-right: 4px solid #CCCCCC;
border-top: 4px solid #CCCCCC;
transform: rotate(45deg);
}
.word {
display: flex;
align-items: center;
& > img {
width: 74px;
height: 74px;
margin: 0 34px;
}
.ellipsis{
width: 450px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
.checkbox {
position: relative;
display: flex;
align-items: center;
& > img {
width: 48px;
height: 48px;
border-radius: 50%;
}
.color {
color: #00aaff;
background-color: #00aaff;
}
}
.person {
display: flex;
align-items: center;
color: #f57a00;
font-size: 36px;
text-align: center;
& > img {
width: 74px;
height: 74px;
margin: 0 34px;
flex-shrink: 0;
}
.ellipsis {
width: 450px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
.checkbox {
position: relative;
display: flex;
align-items: center;
& > img {
width: 48px;
height: 48px;
border-radius: 50%;
}
.color {
color: #00aaff;
background-color: #00aaff;
}
}
.person {
display: flex;
align-items: center;
color: #f57a00;
font-size: 36px;
text-align: center;
margin: 0 34px;
flex-shrink: 0;
}
}
}
}
::v-deep .content {
padding: 0 !important;
}
.pad {
box-sizing: border-box;
padding: 20px 32px 0;
}
}
::v-deep .content {
padding: 0 !important;
}
.pad {
box-sizing: border-box;
padding: 20px 32px 0;
}
}
</style>

View File

@@ -1,185 +1,187 @@
<template>
<view class="imt-audio">
<view class="audio-wrapper">
<view class="audio-number">{{format(current)}}</view>
<slider class="audio-slider" :activeColor="color" block-size="16" :value="current" :max="duration || 10" @changing="seek=true,current=$event.detail.value" @change="audio.seek($event.detail.value)"></slider>
<view class="audio-number">{{format(duration)}}</view>
</view>
<view class="audio-control-wrapper" :style="{color}">
<view class="imt-audio">
<view class="audio-wrapper">
<view class="audio-number">{{ format(current) }}</view>
<slider class="audio-slider" :activeColor="color" block-size="16" :value="current" :max="duration || 10"
@changing="seek=true,current=$event.detail.value" @change="audio.seek($event.detail.value)"></slider>
<view class="audio-number">{{ format(duration) }}</view>
</view>
<view class="audio-control-wrapper" :style="{color}">
<image
class="audio-control audio-control-switch"
@click="audio.paused?play():audio.pause()"
:src="paused ? playImg : stopImg" />
class="audio-control audio-control-switch"
@click="audio.paused?play():audio.pause()"
:src="paused ? playImg : stopImg"/>
<p>{{ paused ? '点击播放' : '点击停止播放' }}</p>
</view>
</view>
</view>
</view>
</template>
<script>
import stopImg from '../pages/resourcesManage/img/stop-img.png'
import playImg from '../pages/resourcesManage/img/play-icon.png'
export default {
data() {
return {
audio: uni.createInnerAudioContext(),
current: 0, //当前进度(s)
duration: 0, //总时长(s)
paused: true, //是否处于暂停状态
loading: false, //是否处于读取状态
seek: false,
stopImg,
playImg
}
},
props: {
src: String, //音频链接
autoplay: Boolean, //是否自动播放
continue: Boolean, //播放完成后是否继续播放下一首,需定义@next事件
control: {
type: Boolean,
default: true
}, //是否需要上一曲/下一曲按钮
color: {
type: String,
default: '#007BFF'
} //主色调
},
methods: {
//返回prev事件
prev() {
this.$emit('prev')
},
//返回next事件
next() {
this.$emit('next')
},
//格式化时长
format(num) {
return '0'.repeat(2 - String(Math.floor(num / 60)).length) + Math.floor(num / 60) + ':' + '0'.repeat(2 - String(Math.floor(num % 60)).length) + Math.floor(num % 60)
},
//点击播放按钮
play() {
this.audio.play()
this.loading = true
}
},
created() {
if (this.src) {
this.audio.src = this.src
this.autoplay && this.play()
}
this.audio.obeyMuteSwitch = false
//音频进度更新事件
this.audio.onTimeUpdate(() => {
if (!this.seek) {
this.current = this.audio.currentTime
}
if (!this.duration) {
this.duration = this.audio.duration
}
})
//音频播放事件
this.audio.onPlay(() => {
this.paused = false
this.loading = false
})
//音频暂停事件
this.audio.onPause(() => {
this.paused = true
})
//音频结束事件
this.audio.onEnded(() => {
if (this.continue) {
this.next()
} else {
this.paused = true
this.current = 0
}
})
//音频完成更改进度事件
this.audio.onSeeked(() => {
this.seek = false
})
},
beforeDestroy(){
this.audio.destroy()
},
watch: {
src(src, old) {
this.audio.src = src
this.current = 0
this.duration = 0
if (old || this.autoplay) {
this.play()
}
}
}
}
import stopImg from '../pages/resourcesManage/img/stop-img.png'
import playImg from '../pages/resourcesManage/img/play-icon.png'
export default {
data() {
return {
audio: uni.createInnerAudioContext(),
current: 0, //当前进度(s)
duration: 0, //总时长(s)
paused: true, //是否处于暂停状态
loading: false, //是否处于读取状态
seek: false,
stopImg,
playImg
}
},
props: {
src: String, //音频链接
autoplay: Boolean, //是否自动播放
continue: Boolean, //播放完成后是否继续播放下一首,需定义@next事件
control: {
type: Boolean,
default: true
}, //是否需要上一曲/下一曲按钮
color: {
type: String,
default: '#007BFF'
} //主色调
},
methods: {
//返回prev事件
prev() {
this.$emit('prev')
},
//返回next事件
next() {
this.$emit('next')
},
//格式化时长
format(num) {
return '0'.repeat(2 - String(Math.floor(num / 60)).length) + Math.floor(num / 60) + ':' + '0'.repeat(2 - String(Math.floor(num % 60)).length) + Math.floor(num % 60)
},
//点击播放按钮
play() {
this.audio.play()
this.loading = true
}
},
created() {
if (this.src) {
this.audio.src = this.src
this.autoplay && this.play()
}
this.audio.obeyMuteSwitch = false
//音频进度更新事件
this.audio.onTimeUpdate(() => {
if (!this.seek) {
this.current = this.audio.currentTime
}
if (!this.duration) {
this.duration = this.audio.duration
}
})
//音频播放事件
this.audio.onPlay(() => {
this.paused = false
this.loading = false
})
//音频暂停事件
this.audio.onPause(() => {
this.paused = true
})
//音频结束事件
this.audio.onEnded(() => {
if (this.continue) {
this.next()
} else {
this.paused = true
this.current = 0
}
})
//音频完成更改进度事件
this.audio.onSeeked(() => {
this.seek = false
})
},
beforeDestroy() {
this.audio.destroy()
},
watch: {
src(src, old) {
this.audio.src = src
this.current = 0
this.duration = 0
if (old || this.autoplay) {
this.play()
}
}
}
}
</script>
<style>
.imt-audio {
background: #fff;
border-radius: 20upx;
}
.imt-audio {
background: #fff;
border-radius: 20 upx;
}
.audio-wrapper {
display: flex;
align-items: center;
}
.audio-wrapper {
display: flex;
align-items: center;
}
.audio-number {
width: 120upx;
font-size: 24upx;
line-height: 1;
color: #999999;
text-align: center;
}
.audio-number {
width: 120 upx;
font-size: 24 upx;
line-height: 1;
color: #999999;
text-align: center;
}
.audio-slider {
flex: 1;
margin: 0;
}
.audio-slider {
flex: 1;
margin: 0;
}
.audio-control-wrapper {
margin-top: 40upx;
text-align: center;
}
.audio-control-wrapper {
margin-top: 40 upx;
text-align: center;
}
.audio-control-wrapper p {
color: #999999;
font-size: 26rpx;
.audio-control-wrapper p {
color: #999999;
font-size: 26 rpx;
}
.audio-control-wrapper image {
width: 128 rpx;
height: 128 rpx;
}
.audio-control {
font-size: 32 upx;
line-height: 1;
border-radius: 50%;
}
.audio-control-next {
transform: rotate(180deg);
}
.audio-control-switch {
font-size: 40 upx;
margin: 0 100 upx;
}
.audioLoading {
animation: loading 2s;
animation-iteration-count: infinite;
animation-timing-function: linear;
}
@keyframes loading {
to {
transform: rotate(360deg);
}
.audio-control-wrapper image {
width: 128rpx;
height: 128rpx;
}
.audio-control {
font-size: 32upx;
line-height: 1;
border-radius: 50%;
}
.audio-control-next {
transform: rotate(180deg);
}
.audio-control-switch {
font-size: 40upx;
margin: 0 100upx;
}
.audioLoading {
animation: loading 2s;
animation-iteration-count: infinite;
animation-timing-function: linear;
}
@keyframes loading {
to {
transform: rotate(360deg);
}
}
}
</style>