zs 1 yıl önce
ebeveyn
işleme
4346a7c75f
2 değiştirilmiş dosya ile 24 ekleme ve 4 silme
  1. 5 0
      src/stores/users/user.ts
  2. 19 4
      src/views/user/user/index.vue

+ 5 - 0
src/stores/users/user.ts

@@ -16,6 +16,10 @@ export const UserStore = defineStore('user', () => {
     const res = await axios.$get(`${api.url}`, cond);
     return res;
   };
+  const user = async (payload: any): Promise<IQueryResult> => {
+    const res = await axios.$get(`${api.url}/user`, payload);
+    return res;
+  };
   const fetch = async (payload: any): Promise<IQueryResult> => {
     const res = await axios.$get(`${api.url}/${payload}`);
     return res;
@@ -40,6 +44,7 @@ export const UserStore = defineStore('user', () => {
   };
   return {
     query,
+    user,
     fetch,
     create,
     update,

+ 19 - 4
src/views/user/user/index.vue

@@ -8,7 +8,13 @@
         <cButton :isAdd="false"> </cButton>
       </el-col>
       <el-col :span="24" class="thr">
-        <cTable :fields="fields" :opera="opera" :list="list" @query="search" @chat="toChat" :total="total"> </cTable>
+        <cTable :fields="fields" :opera="opera" :list="list" @query="search" @chat="toChat" :total="total">
+          <template #is_read="{ item, row }">
+            <template v-if="item.model === 'is_read'">
+              <span :class="[row.is_read == '未读' ? 'text' : '']">{{ row.is_read }}</span>
+            </template>
+          </template>
+        </cTable>
       </el-col>
     </el-col>
   </el-row>
@@ -42,7 +48,7 @@ let searchForm: Ref<any> = ref({});
 
 const search = async (e: { skip: number; limit: number }) => {
   const info = { skip: e.skip, limit: e.limit, ...searchForm.value };
-  const res: IQueryResult = await store.query(info);
+  const res: IQueryResult = await store.user(info);
   if (res.errcode == '0') {
     list.value = res.data;
     total.value = res.total;
@@ -61,7 +67,8 @@ let fields: Ref<any[]> = ref([
   { label: '昵称', model: 'nickname', isSearch: true },
   { label: '姓名', model: 'name', isSearch: true },
   { label: '身份证号', model: 'card', isSearch: true },
-  { label: '电话', model: 'phone', isSearch: true }
+  { label: '电话', model: 'phone', isSearch: true },
+  { label: '是否已读', model: 'is_read', custom: true }
 ]);
 // 操作
 let opera: Ref<any[]> = ref([{ label: '聊天记录', method: 'chat' }]);
@@ -71,4 +78,12 @@ const toChat = async (data: any) => {
 };
 </script>
 
-<style scoped></style>
+<style scoped lang="scss">
+.main {
+  .thr {
+    .text {
+      color: #f10000;
+    }
+  }
+}
+</style>