宋飞杨 1 ano atrás
pai
commit
cc46fb511f

+ 35 - 0
src/components/RichTextWithCopy/RichTextWithCopy.vue

@@ -0,0 +1,35 @@
+<template>
+  <view>
+    <rich-text :nodes="content"></rich-text>
+    <button v-for="(line, index) in lines" :key="index" @click="copyText(line)">{{ line }}</button>
+  </view>
+</template>
+
+<script>
+export default {
+  props: {
+    content: {
+      type: String,
+      default: '',
+    },
+  },
+  computed: {
+    lines() {
+      return this.content.split('<br>');
+    },
+  },
+  methods: {
+    copyText(text) {
+      uni.setClipboardData({
+        data: text,
+        success: function () {
+          uni.showToast({
+            title: '已复制',
+            icon: 'success',
+          });
+        },
+      });
+    },
+  },
+};
+</script>

+ 77 - 28
src/pages/client/tabBar/mine.vue

@@ -6,12 +6,12 @@
           <u-avatar :src="user_info.avatar" @click="onClickAvatar" size="80"></u-avatar>
         </view>
         <view class="user-nickname">
-          <u--text
+          <u-text
             size="18"
             bold
             :text="user_info.nickname ? user_info.nickname : 'fadsfdaf'"
-          ></u--text>
-          <u--text size="12" text="欢迎加入车旅程"></u--text>
+          ></u-text>
+          <u-text size="12" text="欢迎加入车旅程"></u-text>
         </view>
         <view>
           <!-- 已登录 -->
@@ -20,7 +20,7 @@
             <view class="btn-wrap">
               <u-icon
                 size="30"
-                @tap="$Router.push('/pages/client/clientUser/mine/setting')"
+                @tap="$Router.push('/pages/client/clientUser/setting')"
                 name="setting"
               ></u-icon>
             </view>
@@ -92,12 +92,7 @@
 
     <!-- 预约列表 -->
     <view class="appointList">
-      <u-cell
-        icon="setting-fill"
-        title="预约列表"
-        isLink
-        url="/pages/client/clientUser/mine/appoint/appoint"
-      />
+      <u-cell icon="setting-fill" title="预约列表" isLink url="/pages/client/clientUser/appoint" />
       <u-cell icon="setting-fill" title="我要开店" isLink />
     </view>
 
@@ -114,6 +109,29 @@
             isLink
             :url="item.url"
           ></u-cell>
+          <u-cell
+            :border="false"
+            icon="setting-fill"
+            title="客服中心"
+            size="large"
+            isLink
+            @tap="handleServiceCenterClick"
+          />
+          <u-cell
+            :border="false"
+            icon="setting-fill"
+            title="商务合作"
+            size="large"
+            isLink
+            @tap="handleBusinessCooperationClick"
+          />
+          <u-cell
+            icon="setting-fill"
+            title="意见反馈"
+            size="large"
+            isLink
+            @tap="handleFeedbackClick"
+          />
         </u-cell-group>
       </view>
     </view>
@@ -122,9 +140,16 @@
 
 <script>
 import { maintainUserInfo } from '@/api/client/mine.js';
+import RichTextWithCopy from '@/components/RichTextWithCopy/RichTextWithCopy';
 export default {
+  components: {
+    RichTextWithCopy,
+  },
   data() {
     return {
+      // 省略其他内容
+      content: '这里是客服中心内容,用户可以复制<br>第一行文本<br>第二行文本<br>第三行文本',
+
       collectList: [
         {
           name: 'photo',
@@ -200,24 +225,6 @@ export default {
           title: '我要推广',
           url: '/pages/client/clientUser/myGroup',
         },
-        {
-          id: '2',
-          icon: 'setting-fill',
-          title: '客服中心',
-          url: '/pages/client/clientUser/serviceCenter',
-        },
-        {
-          id: '3',
-          icon: 'setting-fill',
-          title: '商务合作',
-          url: '/pages/client/clientUser/serviceCenter',
-        },
-        {
-          id: '4',
-          icon: 'setting-fill',
-          title: '意见反馈',
-          url: '/pages/client/clientUser/serviceCenter',
-        },
       ],
       user_info: {}, // 个人信息
       avatar: '/pages/static', // 用于存储图片路径
@@ -306,6 +313,48 @@ export default {
         url: '/pages/client/clientUser/myProfit',
       });
     },
+    // 点击 "客服中心" 菜单项
+    handleServiceCenterClick() {
+      uni.showModal({
+        title: '客服中心',
+        content: '<rich-text-with-copy :content="content"></rich-text-with-copy>',
+        showCancel: false,
+        confirmText: '知道了',
+        richContent: true, // 使用富文本显示内容
+      });
+    },
+
+    // 点击 "商务合作" 菜单项
+    handleBusinessCooperationClick() {
+      uni.showModal({
+        title: '商务合作',
+        content: '111111111111111111',
+        showCancel: false,
+        confirmText: '知道了',
+        richContent: true, // 使用富文本显示内容
+      });
+    },
+
+    // 点击 "意见反馈" 菜单项
+    handleFeedbackClick() {
+      uni.showModal({
+        title: '意见反馈',
+        content: '',
+        showCancel: false,
+        confirmText: '提交',
+        contentInput: true, // 使用输入框内容
+        inputPlaceHolder: '请输入您的意见反馈,最多500个字符',
+        inputMaxLength: 500, // 设置输入框最大长度
+        success: res => {
+          if (res.confirm) {
+            // 获取用户输入的意见反馈内容
+            const feedback = res.inputValue;
+            console.log('用户的意见反馈内容:', feedback);
+            // 在这里可以将用户的反馈内容进行处理,比如发送给服务器等操作
+          }
+        },
+      });
+    },
   },
 };
 </script>