Procházet zdrojové kódy

切换身份弹框提示完成

宋飞杨 před 1 rokem
rodič
revize
b105212da5

+ 45 - 0
src/components/SwitchIdentityDialog/SwitchIdentityDialog.vue

@@ -0,0 +1,45 @@
+<template>
+  <div class="switch-identity-dialog">
+    <div class="content">
+      <slot></slot>
+    </div>
+    <div class="buttons">
+      <button class="buttonsok" @click="confirm">确定</button>
+
+      <button class="buttonsno" @click="cancel">取消</button>
+    </div>
+  </div>
+</template>
+
+<script>
+export default {
+  methods: {
+    confirm() {
+      this.$emit('confirm');
+    },
+    cancel() {
+      this.$emit('cancel');
+    },
+  },
+};
+</script>
+
+<style scoped>
+.switch-identity-dialog {
+  /* 样式设置 */
+  width: 600rpx;
+  height: auto;
+  position: fixed; /* 固定在页面上 */
+  top: 50%; /* 顶部位置 */
+  left: 50%; /* 左侧位置 */
+  transform: translate(-50%, -50%); /* 居中显示 */
+  background-color: #fff;
+  border: 1px solid #ccc;
+  padding: 20px;
+  z-index: 999; /* 控制弹框在其它元素之上 */
+}
+.content {
+  /* p标签文字样式设置 */
+  font-size: 36rpx;
+}
+</style>

+ 37 - 3
src/pages/client/clientUser/mine/setting.vue

@@ -47,11 +47,22 @@
         </u-cell-group>
         </u-cell-group>
       </view>
       </view>
     </view>
     </view>
-
+    <SwitchIdentityDialog v-if="showSwitchDialog" @confirm="confirmSwitch" @cancel="cancelSwitch">
+      <p>您确定要从用户/商家端切换到商家段/用户端吗?</p>
+      <br />
+      <br />
+    </SwitchIdentityDialog>
     <view class="policy-out-box">
     <view class="policy-out-box">
       <view class="policy-inner-box">
       <view class="policy-inner-box">
         <u-cell-group :border="false">
         <u-cell-group :border="false">
-          <u-cell size="large" :border="false" icon="level" title="切换身份" isLink url="" />
+          <u-cell
+            size="large"
+            :border="false"
+            icon="level"
+            title="切换身份"
+            isLink
+            @click="openSwitchDialog"
+          />
         </u-cell-group>
         </u-cell-group>
       </view>
       </view>
     </view>
     </view>
@@ -71,9 +82,16 @@
 </template>
 </template>
 
 
 <script>
 <script>
+import SwitchIdentityDialog from '@/components/SwitchIdentityDialog/SwitchIdentityDialog.vue';
+
 export default {
 export default {
+  components: {
+    SwitchIdentityDialog,
+  },
   data() {
   data() {
-    return {};
+    return {
+      showSwitchDialog: false,
+    };
   },
   },
 
 
   mounted() {},
   mounted() {},
@@ -99,6 +117,22 @@ export default {
         url: '/pages/client/clientUser/myProfit',
         url: '/pages/client/clientUser/myProfit',
       });
       });
     },
     },
+    // 点击身份切换
+    openSwitchDialog() {
+      // 打开切换身份确认弹框
+      this.showSwitchDialog = true;
+    },
+    confirmSwitch() {
+      // 点击确认切换身份
+      // 处理身份切换逻辑
+      this.showSwitchDialog = false;
+      // ... 其他操作
+    },
+    cancelSwitch() {
+      // 点击取消切换身份
+      this.showSwitchDialog = false;
+      // ... 其他操作
+    },
   },
   },
 };
 };
 </script>
 </script>