|
@@ -5,7 +5,7 @@
|
|
|
overlay-class="levitated-sphere-overlay" :overlay-style="{'background-color': 'transparent !important'}" :style="{ height: '100%', 'background-color': '#2C2C2D' }">
|
|
|
<div class="menu-wrap">
|
|
|
<!-- 头部云机id等信息 -->
|
|
|
- <CloudMainPanel id="pupop-header" />
|
|
|
+ <CloudMainPanel id="pupop-header" v-bind="$attrs" v-on="$listeners" :userCardId="userCardId" :cloudList="cloudList" />
|
|
|
|
|
|
<!-- 功能区域 -->
|
|
|
<FunctionMenu id="function-menu" @functionMenuVisible="scrollHeight" @funcHandle="funcHandle"/>
|
|
@@ -13,15 +13,15 @@
|
|
|
<!-- 包一层是为了获取区域的height计算云机列表滚动高度 -->
|
|
|
<div id="select-wrap">
|
|
|
<!-- 下拉选项区 -->
|
|
|
- <CloudGroupDropdown v-bind="$attrs" v-on="$listeners" :engine="engine" @dropdownVisibleChange="(val)=>(popupMaskOverflowY = val)"/>
|
|
|
+ <CloudGroupDropdown v-bind="$attrs" v-on="$listeners" :engine="engine" :activeGroupId.sync="activeGroupId" @dropdownVisibleChange="(val)=>(popupMaskOverflowY = val)"/>
|
|
|
</div>
|
|
|
-
|
|
|
+
|
|
|
<!-- 云机列表 -->
|
|
|
- <CloudList id="cloud-list" :height="`${cloudListScrollHeight}px`"/>
|
|
|
+ <CloudList id="cloud-list" v-bind="$attrs" v-on="$listeners" :activeGroupId="activeGroupId" :userCardId="userCardId" :cloudList="cloudList" :height="`${cloudListScrollHeight}px`"/>
|
|
|
|
|
|
<!-- 退出 -->
|
|
|
<div id="exit-wrap">
|
|
|
- <van-button class="exit-btn" type="primary" size="small" color="#3370FF">退出并下机</van-button>
|
|
|
+ <van-button class="exit-btn" type="primary" size="small" color="#3370FF" @click="exit">退出并下机</van-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
</van-popup>
|
|
@@ -46,9 +46,14 @@ export default {
|
|
|
default: () => ({})
|
|
|
},
|
|
|
userCardId: {
|
|
|
- type: String,
|
|
|
+ type: [String, Number],
|
|
|
default: ''
|
|
|
},
|
|
|
+ // 云机列表
|
|
|
+ cloudList: {
|
|
|
+ type: Array,
|
|
|
+ default: () => []
|
|
|
+ },
|
|
|
// popup是否显示
|
|
|
levitatedSphereVisible: {
|
|
|
type: Boolean,
|
|
@@ -114,11 +119,11 @@ export default {
|
|
|
* 解决方法: 在下拉框弹出时,设置popupMaskOverflowY为true, 关闭下拉框时,设置popupMaskOverflowY为false
|
|
|
* */
|
|
|
popupMaskOverflowY: true,
|
|
|
+
|
|
|
+ // 当前选择的云机分组id 默认-1, 代表全部设备
|
|
|
+ activeGroupId: -1,
|
|
|
}
|
|
|
},
|
|
|
- computed: {
|
|
|
-
|
|
|
- },
|
|
|
watch: {
|
|
|
levitatedSphereVisible(val) {
|
|
|
// 弹窗显示时,获取云机列表的高度
|
|
@@ -182,6 +187,56 @@ export default {
|
|
|
showChange(val){
|
|
|
this.$emit('update:levitatedSphereVisible', val);
|
|
|
},
|
|
|
+ async exit(){
|
|
|
+ try {
|
|
|
+ const activeCloud = this.cloudList.find(item => item.userCardId === +this.userCardId);
|
|
|
+ // 判断当前云机
|
|
|
+ // 1、2、3:年卡、普通计时、自动续费普通计时卡
|
|
|
+ if ([1, 2, 3].includes(activeCloud.userCardType)) {
|
|
|
+ this.$dialog.alert({
|
|
|
+ title: '提示',
|
|
|
+ message: '确定退出云手机并下机',
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ confirmButtonColor: '#3cc51f',
|
|
|
+ showCancelButton: true,
|
|
|
+ beforeClose: (action, done) => {
|
|
|
+ if (action === 'cancel') done()
|
|
|
+
|
|
|
+ if (action === 'confirm') {
|
|
|
+ this.$axios.get('/resources/yearMember/downline?userCardId=${this.userCardId}`')
|
|
|
+ .then((res) => {
|
|
|
+ if(!res.status){
|
|
|
+ done(true);
|
|
|
+ // 判断是否是顶级窗口(不是嵌套在 iframe 中)目前只有ios的浏览器中才会是顶级窗口
|
|
|
+ const isTopWindow = window.parent === window.self;
|
|
|
+ if(isTopWindow){
|
|
|
+ // 通信给h5项目告知是退出并下机
|
|
|
+ parent.postMessage({ type: 'exit' }, '*');
|
|
|
+ uni.postMessage({ data: { type: 'exit' }});
|
|
|
+ }
|
|
|
+
|
|
|
+ // 关闭popup
|
|
|
+ this.$emit('update:levitatedSphereVisible', false);
|
|
|
+
|
|
|
+ this.$emit('exit');
|
|
|
+ } else {
|
|
|
+ done(false);
|
|
|
+ this.$toast(res.msg);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ // 关闭popup
|
|
|
+ this.$emit('update:levitatedSphereVisible', false);
|
|
|
+
|
|
|
+ this.$emit('exit');
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</script>
|