| @@ -7,6 +7,12 @@ | |||||
| .btn-hover-primary { | .btn-hover-primary { | ||||
| color: #0056b3 !important; | color: #0056b3 !important; | ||||
| } | } | ||||
| .card-hover-gray { | |||||
| background-color: #EEE; | |||||
| } | |||||
| .card-hover-white { | |||||
| background-color: #FFF; | |||||
| } | |||||
| .btn-secondary:hover { | .btn-secondary:hover { | ||||
| background-color: #6c757d; | background-color: #6c757d; | ||||
| @@ -29,6 +29,3 @@ | |||||
| .nut-elevator__list__item__name { | .nut-elevator__list__item__name { | ||||
| padding: 0; | padding: 0; | ||||
| } | } | ||||
| .item-hover { | |||||
| background-color: #EEE; | |||||
| } | |||||
| @@ -26,7 +26,7 @@ const clickItem = (key: string, item: ContactData) => { | |||||
| <template> | <template> | ||||
| <nut-elevator :index-list="props.items" is-sticky style="height: 100%" :height="100" @click-item="clickItem"> | <nut-elevator :index-list="props.items" is-sticky style="height: 100%" :height="100" @click-item="clickItem"> | ||||
| <template #default="{ item }"> | <template #default="{ item }"> | ||||
| <view class="d-flex flex-row pl-3 pr-3 pb-2 w-100" @tap="onItemTap(this)" hover-class="item-hover"> | |||||
| <view class="d-flex flex-row pl-3 pr-3 pb-2 w-100" hover-class="card-hover-gray"> | |||||
| <view class="pr-4 pt-2 h6"> | <view class="pr-4 pt-2 h6"> | ||||
| <NutBadge :value="item.isVIP?'VIP':''"> | <NutBadge :value="item.isVIP?'VIP':''"> | ||||
| <NutAvatar size="normal" color="white" :bg-color="BjxHelper.mbString2RgbHex(item.name)" class="overflow-hidden"> | <NutAvatar size="normal" color="white" :bg-color="BjxHelper.mbString2RgbHex(item.name)" class="overflow-hidden"> | ||||
| @@ -1,6 +1,8 @@ | |||||
| <script setup> | <script setup> | ||||
| import './index.scss' | import './index.scss' | ||||
| import { BjxHelper } from "../../utils"; | import { BjxHelper } from "../../utils"; | ||||
| import {useContactsStore} from "../../stores/contacts"; | |||||
| import {Router} from "tarojs-router-next"; | |||||
| /** | /** | ||||
| * props: todayPassTime: Json Array | * props: todayPassTime: Json Array | ||||
| @@ -11,6 +13,13 @@ const item = props.item.passRecords[0] | |||||
| const otherItems = props.item.passRecords.slice(1) | const otherItems = props.item.passRecords.slice(1) | ||||
| // console.log(item.userName, otherItems.length , otherItems) | // console.log(item.userName, otherItems.length , otherItems) | ||||
| let lastName = BjxHelper.getBJXFirstChar(item.userName) | let lastName = BjxHelper.getBJXFirstChar(item.userName) | ||||
| const contacts = useContactsStore() | |||||
| const goContactInfoPage = () => { | |||||
| console.log(item) | |||||
| const contactData = contacts.getContactById(item.userId) | |||||
| Router.toContactEdit({ data: contactData }) | |||||
| } | |||||
| </script> | </script> | ||||
| @@ -18,7 +27,7 @@ let lastName = BjxHelper.getBJXFirstChar(item.userName) | |||||
| <view class="container"> | <view class="container"> | ||||
| <view class="pt-2"></view> | <view class="pt-2"></view> | ||||
| <view class="card mr-3 bg-light"> | <view class="card mr-3 bg-light"> | ||||
| <view class="card-body"> | |||||
| <view class="card-body" hover-class="card-hover-white" @tap="goContactInfoPage"> | |||||
| <view class="d-flex flex-row"> | <view class="d-flex flex-row"> | ||||
| <view class="pr-3 h6"> | <view class="pr-3 h6"> | ||||
| <NutBadge :value="item.isVIP?'VIP':''"> | <NutBadge :value="item.isVIP?'VIP':''"> | ||||
| @@ -132,17 +132,21 @@ const onDeleteConfirm = (item) => { | |||||
| <view class="scroll"> | <view class="scroll"> | ||||
| <ContactForm :data="contactData"/> | <ContactForm :data="contactData"/> | ||||
| <nut-cell title="来访记录" @tap="onClickPassRecords"> | |||||
| <template #desc> | |||||
| <Text className="fas fa-chevron-right"/> | |||||
| </template> | |||||
| </nut-cell> | |||||
| <view hover-class="card-hover-gray"> | |||||
| <nut-cell title="来访记录" @tap="onClickPassRecords"> | |||||
| <template #desc> | |||||
| <Text className="fas fa-chevron-right"/> | |||||
| </template> | |||||
| </nut-cell> | |||||
| </view> | |||||
| <view hover-class="card-hover-gray"> | |||||
| <nut-cell title="编辑记录" sub-title="本联系人在公司中的所有信息修改记录" @tap="onClickEditRecords"> | <nut-cell title="编辑记录" sub-title="本联系人在公司中的所有信息修改记录" @tap="onClickEditRecords"> | ||||
| <template #desc> | <template #desc> | ||||
| <Text className="fas fa-chevron-right"/> | <Text className="fas fa-chevron-right"/> | ||||
| </template> | </template> | ||||
| </nut-cell> | </nut-cell> | ||||
| </view> | |||||
| <view class="p-3"> | <view class="p-3"> | ||||
| <nut-button v-if="contactData.isBlock" block color="red" plain @tap="onBlockConfirm">取消阻止此联系人</nut-button> | <nut-button v-if="contactData.isBlock" block color="red" plain @tap="onBlockConfirm">取消阻止此联系人</nut-button> | ||||
| @@ -5,6 +5,7 @@ import { View } from '@tarojs/components' | |||||
| import './index.scss' | import './index.scss' | ||||
| import {weappAuth} from "../../utils"; | import {weappAuth} from "../../utils"; | ||||
| import {GroupedPassRecords, usePassRecordsStore} from "../../stores/pass-records"; | import {GroupedPassRecords, usePassRecordsStore} from "../../stores/pass-records"; | ||||
| import {useContactsStore} from "../../stores/contacts"; | |||||
| const state = reactive<{ | const state = reactive<{ | ||||
| isPageDataLoading: boolean, | isPageDataLoading: boolean, | ||||
| @@ -16,6 +17,7 @@ const state = reactive<{ | |||||
| groupedPassRecords: [], | groupedPassRecords: [], | ||||
| }) | }) | ||||
| const passRecords = usePassRecordsStore() | const passRecords = usePassRecordsStore() | ||||
| const contacts = useContactsStore() | |||||
| init() | init() | ||||
| @@ -26,10 +28,17 @@ function init() { | |||||
| weappAuth().then(r => { | weappAuth().then(r => { | ||||
| console.log(r) | console.log(r) | ||||
| passRecords.loadPassRecordsFromServer().then( passRecords => { | passRecords.loadPassRecordsFromServer().then( passRecords => { | ||||
| state.isPageDataLoading = false | |||||
| state.groupedPassRecords = passRecords | state.groupedPassRecords = passRecords | ||||
| console.log("aaa",state.groupedPassRecords ) | console.log("aaa",state.groupedPassRecords ) | ||||
| // console.log(state.groupedPassRecords) | // console.log(state.groupedPassRecords) | ||||
| contacts.loadContactsFromServer().then( contacts => { | |||||
| state.isPageDataLoading = false | |||||
| }) | |||||
| .catch(contactError => { | |||||
| console.log("error", contactError) | |||||
| state.isAuthError = true | |||||
| state.isPageDataLoading = false | |||||
| }) | |||||
| }) | }) | ||||
| .catch(error => { | .catch(error => { | ||||
| console.log("error", error) | console.log("error", error) | ||||
| @@ -76,6 +76,15 @@ export const useContactsStore = defineStore('contacts', () => { | |||||
| }) | }) | ||||
| } | } | ||||
| function getContactById(id: number) { | |||||
| for(const contact of allContacts.value) { | |||||
| console.log(contact) | |||||
| if (contact.id === id) { | |||||
| return contact | |||||
| } | |||||
| } | |||||
| return undefined | |||||
| } | |||||
| function searchContacts(searchQuery: string) { | function searchContacts(searchQuery: string) { | ||||
| const searchedContacts: ContactData[] = [] | const searchedContacts: ContactData[] = [] | ||||
| for(const item of allContacts.value) { | for(const item of allContacts.value) { | ||||
| @@ -86,7 +95,7 @@ export const useContactsStore = defineStore('contacts', () => { | |||||
| return searchedContacts | return searchedContacts | ||||
| } | } | ||||
| return { allContacts , isContactsLoaded, loadContactsFromServer, searchContacts} | |||||
| return { allContacts , isContactsLoaded, loadContactsFromServer, searchContacts, getContactById} | |||||
| }) | }) | ||||
| // You can even use a function (similar to a component setup()) to define a Store for more advanced use cases: | // You can even use a function (similar to a component setup()) to define a Store for more advanced use cases: | ||||