PersonalCenter.vue 27 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010
  1. <template>
  2. <div class="personal">
  3. <Breadcrumb />
  4. <div class="personal-head">
  5. <el-avatar :size="100"
  6. :src="appStore?.userInfo?.userAvatar ? appStore.userInfo.userAvatar : appStore.avatarDefault" />
  7. <div class="personal-head-box">
  8. <div class="personal-head-top">
  9. <div class="personal-head-left">
  10. <div class="personal-user-info">
  11. <div class="personal-username">
  12. <div class="">{{ appStore?.userInfo?.nickName }}</div>
  13. <template v-if="['0', '1', '2'].includes(appStore?.userInfo?.memberType)"></template>
  14. <img :src="`/src/assets/imgs/my/vip${appStore?.userInfo?.memberType}@2x.png`" alt="">
  15. <!-- memberType 会员类型memberType 会员类型分为企业会员(2)和个人会员(1)、免费会员(0) -->
  16. </div>
  17. <div class="personal-user-phone mt4">{{ $t('personalCenter.phoneNumber') }}:{{
  18. appStore?.userInfo?.userPhone
  19. }}
  20. </div>
  21. <div class="" v-if="['1', '2'].includes(appStore?.userInfo?.memberType)">{{
  22. $t('personalCenter.vipEndTime')
  23. }}: {{
  24. appStore?.userInfo?.memberExpire }}</div>
  25. <div class="mt4" v-if="appStore?.userInfo?.skillTags">
  26. <el-button v-for="(item, index) in appStore.userInfo.skillTags.split(',')" type="primary" plain>{{ item
  27. }}</el-button>
  28. </div>
  29. </div>
  30. </div>
  31. <div class="personal-head-right">
  32. <div @click="dialogVisible = true" class="personal-head-right-li">
  33. <img src="/src/assets/imgs/my/bianji@2x.png" alt="">
  34. <div class="">{{ $t('personalCenter.editProfile') }}</div>
  35. </div>
  36. <div @click="router.push({ path: '/member' })" class="personal-head-right-li">
  37. <img src="/src/assets/imgs/my/huiyuan@2x.png" alt="">
  38. <div class="">{{ $t('personalCenter.openMembership') }}</div>
  39. </div>
  40. <div @click="signIn" class="personal-head-right-li gradient">
  41. <img src="/src/assets/imgs/my/qiandao@2x.png" alt="">
  42. <div class="">{{ $t('personalCenter.checkIn') }}</div>
  43. </div>
  44. </div>
  45. </div>
  46. <div class="personal-head-bot">
  47. <div class="personal-user-list">
  48. <div class="personal-user-li">
  49. <span>{{ appStore?.userInfo?.pointsBalance || 0 }}</span>
  50. <span>{{ $t('common.mibi') }}</span>
  51. </div>
  52. <div class="personal-user-line"></div>
  53. <div class="personal-user-li">
  54. <span>{{ appStore?.userInfo?.baoMiBalance || 0 }}</span>
  55. <span>{{ $t('common.baomibi') }}</span>
  56. </div>
  57. <div class="btn">
  58. <el-button type="primary" @click="router.push({
  59. path: `/order-confirm`,
  60. })">{{ $t('route.recharge') }}</el-button>
  61. </div>
  62. <!-- <div class="personal-user-line"></div> -->
  63. </div>
  64. <div class="personal-user-list">
  65. <div class="personal-user-li">
  66. <span>{{ collectCount }}</span>
  67. <span>{{ $t('common.collect') }}</span>
  68. </div>
  69. </div>
  70. </div>
  71. </div>
  72. </div>
  73. <div class="personal-main">
  74. <div class="personal-left">
  75. <div class="personal-left-list">
  76. <template v-for="(item, index) in navList" :key="index">
  77. <div v-if="item.show" @click="toPath(item, index)" :class="{ active: index == navIndex }"
  78. class="personal-left-li">
  79. <img v-if="index == navIndex" :src="item.iconActive" alt="">
  80. <img v-else :src="item.icon" alt="">
  81. <div class="">{{ $t(item.name) }}</div>
  82. </div>
  83. </template>
  84. </div>
  85. </div>
  86. <div class="personal-right">
  87. <div class="personal-right-main">
  88. <router-view />
  89. </div>
  90. </div>
  91. </div>
  92. <!-- 工单 -->
  93. <div class="workOrder-dot" @click="show = true">
  94. <img src="/src/assets/imgs/my/icon9a@2x.png" alt="">
  95. <div class="">{{ $t('personalCenter.gongdan') }}</div>
  96. </div>
  97. <el-dialog v-model="show" :title="`${$t('personalCenter.gongdan')}`" width="784">
  98. <el-tabs v-model="activeName" @tab-click="handleClick">
  99. <el-tab-pane v-for="tab in tabs" :key="tab.name" :label="`${$t(tab.label)}`" :name="tab.name">
  100. <template v-if="activeName == 0">
  101. <el-form ref="ruleFormRef" :model="ruleForm" :rules="rules" label-width="auto">
  102. <el-form-item :label="`${$t('personalCenter.gongdanleixing')}`" prop="issueCategory">
  103. <el-select v-model="ruleForm.issueCategory" :placeholder="`${$t('common.qingxuanze')}`"
  104. style="width: 100%">
  105. <el-option v-for="item in workTypeList" :key="item.value" :label="`${$t(item.label)}`"
  106. :value="item.value" />
  107. </el-select>
  108. </el-form-item>
  109. <el-form-item :label="`${$t('personalCenter.gongdanbiaoti')}`" prop="issueTitle">
  110. <el-input v-model="ruleForm.issueTitle" :placeholder="`${$t('common.placeholderInput')}`" />
  111. </el-form-item>
  112. <el-form-item :label="`${$t('personalCenter.gongdanneirong')}`" prop="issueContent">
  113. <el-input v-model="ruleForm.issueContent" :placeholder="`${$t('common.placeholderInput')}`" :rows="2"
  114. type="textarea" />
  115. </el-form-item>
  116. </el-form>
  117. </template>
  118. <template v-else>
  119. <el-collapse v-model="workName" accordion>
  120. <el-collapse-item :title="item.issueTitle || `${index + 1}、${item.question}`" :name="item.id"
  121. v-for="(item, index) in workList" :key="index">
  122. <template #title >
  123. <div class="work-head">
  124. <img v-if="activeName == 2" src="/src/assets/imgs/my/Q@2x.png" alt="">
  125. <div class="">{{ `${ activeName == 2 ? (index + 1) + '、' : '' }` }}{{ item.issueTitle || item.question }}</div>
  126. </div>
  127. </template>
  128. <div class="work-content">
  129. <img v-if="activeName == 2" src="/src/assets/imgs/my/A@2x.png" alt="">
  130. <div class="">{{ item.issueContent || item.answer }}</div>
  131. </div>
  132. </el-collapse-item>
  133. </el-collapse>
  134. <template v-if="workList && workList.length">
  135. <Pagination :total="workForm.total" :page-size="workForm.pageSize" :current-page="workForm.pageNum"
  136. @page-change="handlePageChange" />
  137. </template>
  138. <el-empty v-else :description="$t('common.empty')" />
  139. </template>
  140. </el-tab-pane>
  141. </el-tabs>
  142. <template #footer v-if="activeName == 0">
  143. <div class="dialog-footer flex-center">
  144. <el-button @click="resetForm">{{ $t('common.cancel') }}</el-button>
  145. <el-button class="gradient" type="primary" @click="submitForm(ruleFormRef)">{{ $t('common.confirm')
  146. }}</el-button>
  147. </div>
  148. </template>
  149. </el-dialog>
  150. <el-dialog v-model="dialogVisible" title="编辑资料" width="784">
  151. <el-form :model="userInfo" label-width="auto" label-position="top">
  152. <el-row :gutter="16">
  153. <el-col :span="12">
  154. <el-form-item label="上传头像">
  155. <!-- 图片类型 -->
  156. <FileUploader ref="fileUploader" accept="image/*" :multiple="false" :limit="1" :auto-upload="true"
  157. list-type="picture-card" :data="{ directory: 'workflow' }" buttonText="" v-model="coverImage" tip="" />
  158. </el-form-item>
  159. </el-col>
  160. </el-row>
  161. <el-row :gutter="16">
  162. <el-col :span="12">
  163. <el-form-item label="昵称">
  164. <el-input v-model="userInfo.nickName" :placeholder="$t('common.placeholderInput')" class="inputStyle"
  165. :input-style="{
  166. backgroundColor: 'transparent',
  167. }" />
  168. </el-form-item>
  169. </el-col>
  170. <el-col :span="12">
  171. <el-form-item label="登录手机号">
  172. <el-input :disabled="userInfo.userPhone ? true : false" v-model="userInfo.userPhone"
  173. :placeholder="$t('common.placeholderInput')" class="inputStyle" :input-style="{
  174. backgroundColor: 'transparent',
  175. }" />
  176. </el-form-item>
  177. </el-col>
  178. </el-row>
  179. <el-row :gutter="16">
  180. <el-col :span="12">
  181. <el-form-item label="登录邮箱">
  182. <el-input v-model="userInfo.name" :placeholder="$t('common.placeholderInput')" class="inputStyle"
  183. :input-style="{
  184. backgroundColor: 'transparent',
  185. }" />
  186. </el-form-item>
  187. </el-col>
  188. <el-col :span="12">
  189. <el-form-item label="验证码" prop="verifyCode">
  190. <el-input v-model="userInfo.verifyCode" :placeholder="$t('common.placeholderInput')" class="inputStyle"
  191. :input-style="{
  192. backgroundColor: 'transparent',
  193. }">
  194. <template #append>
  195. <el-button type="primary" :disabled="smsCountdown > 0" @click="sendSmsCode" style="width:140px"
  196. :class="{ 'countdown-btn': smsCountdown > 0 }" size="small">
  197. {{ smsCountdown > 0 ? `${smsCountdown}s` : $t('login.sendCaptcha') }}
  198. </el-button>
  199. </template>
  200. </el-input>
  201. </el-form-item>
  202. </el-col>
  203. </el-row>
  204. <el-row :gutter="16">
  205. <el-col :span="12">
  206. <el-form-item label="n8n账号">
  207. <el-input v-model="userInfo.name" :placeholder="$t('common.placeholderInput')" class="inputStyle"
  208. :input-style="{
  209. backgroundColor: 'transparent',
  210. }">
  211. <template #append>
  212. <el-button :icon="Refresh" />
  213. </template>
  214. </el-input>
  215. </el-form-item>
  216. </el-col>
  217. <el-col :span="12">
  218. <el-form-item label="n8n初始密码">
  219. <el-input v-model="userInfo.userPhone" :placeholder="$t('common.placeholderInput')" class="inputStyle"
  220. :input-style="{
  221. backgroundColor: 'transparent',
  222. }" readonly type="password" show-password />
  223. </el-form-item>
  224. </el-col>
  225. </el-row>
  226. <el-row :gutter="16">
  227. <el-col :span="12">
  228. <el-form-item label="Coze账号">
  229. <el-input v-model="userInfo.name" :placeholder="$t('common.placeholderInput')" class="inputStyle"
  230. :input-style="{
  231. backgroundColor: 'transparent',
  232. }">
  233. <template #append>
  234. <el-button :icon="Refresh" />
  235. </template>
  236. </el-input>
  237. </el-form-item>
  238. </el-col>
  239. <el-col :span="12">
  240. <el-form-item label="Coze初始密码">
  241. <el-input v-model="userInfo.name" :placeholder="$t('common.placeholderInput')" class="inputStyle"
  242. :input-style="{
  243. backgroundColor: 'transparent',
  244. }" readonly type="password" show-password />
  245. </el-form-item>
  246. </el-col>
  247. </el-row>
  248. <el-row :gutter="16">
  249. <el-col :span="12">
  250. <el-form-item label="Dify账号">
  251. <el-input v-model="userInfo.name" :placeholder="$t('common.placeholderInput')" class="inputStyle"
  252. :input-style="{
  253. backgroundColor: 'transparent',
  254. }">
  255. <template #append>
  256. <el-button :icon="Refresh" />
  257. </template>
  258. </el-input>
  259. </el-form-item>
  260. </el-col>
  261. <el-col :span="12">
  262. <el-form-item label="Dify初始密码">
  263. <el-input v-model="userInfo.name" :placeholder="$t('common.placeholderInput')" class="inputStyle"
  264. :input-style="{
  265. backgroundColor: 'transparent',
  266. }" readonly type="password" show-password />
  267. </el-form-item>
  268. </el-col>
  269. </el-row>
  270. <el-row :gutter="16">
  271. <el-col :span="12">
  272. <el-form-item label="FastGpt账号">
  273. <el-input v-model="userInfo.name" :placeholder="$t('common.placeholderInput')" class="inputStyle"
  274. :input-style="{
  275. backgroundColor: 'transparent',
  276. }">
  277. <template #append>
  278. <el-button :icon="Refresh" />
  279. </template>
  280. </el-input>
  281. </el-form-item>
  282. </el-col>
  283. <el-col :span="12">
  284. <el-form-item label="FastGpt初始密码">
  285. <el-input v-model="userInfo.name" :placeholder="$t('common.placeholderInput')" class="inputStyle"
  286. :input-style="{
  287. backgroundColor: 'transparent',
  288. }" readonly type="password" show-password />
  289. </el-form-item>
  290. </el-col>
  291. </el-row>
  292. <el-row>
  293. <el-col :span="24">
  294. <el-form-item label="技能标签">
  295. <div class="flex tags flex_1">
  296. <el-tag v-for="tag in dynamicTags" :key="tag" closable @close="handleClose(tag)">
  297. {{ tag }}
  298. </el-tag>
  299. <el-input v-if="inputVisible" ref="InputRef" v-model="inputValue" class="w-20" size="small"
  300. @keyup.enter="handleInputConfirm" @blur="handleInputConfirm" maxlength="5">
  301. <template #append>
  302. <el-button :icon="Plus" />
  303. </template></el-input>
  304. <el-button v-else class="button-new-tag" size="small" @click="showInput">
  305. + {{ $t('common.addTags') }}
  306. </el-button>
  307. </div>
  308. </el-form-item>
  309. </el-col>
  310. </el-row>
  311. </el-form>
  312. <template #footer>
  313. <div class="dialog-footer flex-center">
  314. <el-button @click="dialogVisible = false">{{ $t('common.cancel') }}</el-button>
  315. <el-button class="gradient" type="primary" @click="handleConfirm">
  316. {{ $t('common.confirm') }}
  317. </el-button>
  318. </div>
  319. </template>
  320. </el-dialog>
  321. </div>
  322. </template>
  323. <script setup lang="ts">
  324. import { Plus, Refresh } from '@element-plus/icons-vue'
  325. import { useAppStore } from '@/pinia/appStore'
  326. import { ref, onMounted, computed, nextTick } from 'vue';
  327. import type { InputInstance } from 'element-plus'
  328. import { useRoute, useRouter } from 'vue-router'
  329. import { getUserInfo, updateUserInfo } from '@/api/auth.js'
  330. import { checkIn, queryCollectCount, issue, issueList, faqList, getfaq } from '@/api/my.js'
  331. import DGTMessage from '@/utils/message'
  332. import { useI18n } from 'vue-i18n'
  333. import FileUploader from '@/components/FileUploader.vue'
  334. import Pagination from '@/components/Pagination.vue'
  335. import type { FormInstance, FormRules } from 'element-plus'
  336. interface RuleForm {
  337. issueCategory: string
  338. issueTitle: string
  339. issueContent: string
  340. }
  341. const ruleFormRef = ref(null);
  342. const { t } = useI18n()
  343. const appStore = useAppStore();
  344. const route = useRoute()
  345. const router = useRouter()
  346. const navList = ref([
  347. {
  348. name: 'personalCenter.myWallet',
  349. path: '/personal-center/wallet',
  350. icon: '/src/assets/imgs/my/icon1@2x.png',
  351. iconActive: '/src/assets/imgs/my/icon1a@2x.png',
  352. show: true
  353. },
  354. {
  355. name: 'personalCenter.membershipInfo',
  356. path: '/personal-center/member-details',
  357. icon: '/src/assets/imgs/my/icon2@2x.png',
  358. iconActive: '/src/assets/imgs/my/icon2a@2x.png',
  359. show: true
  360. },
  361. {
  362. name: 'personalCenter.myCollection',
  363. path: '/personal-center/collection',
  364. icon: '/src/assets/imgs/my/icon3@2x.png',
  365. iconActive: '/src/assets/imgs/my/icon3a@2x.png',
  366. show: true
  367. },
  368. {
  369. name: 'personalCenter.myDemand',
  370. path: '/personal-center/demand',
  371. icon: '/src/assets/imgs/my/icon4@2x.png',
  372. iconActive: '/src/assets/imgs/my/icon4a@2x.png',
  373. show: true
  374. },
  375. {
  376. name: 'personalCenter.myOrders',
  377. path: '/personal-center/orders',
  378. icon: '/src/assets/imgs/my/icon5@2x.png',
  379. iconActive: '/src/assets/imgs/my/icon5a@2x.png',
  380. show: true
  381. },
  382. {
  383. name: 'personalCenter.myInvoice',
  384. path: '/personal-center/invoice',
  385. icon: '/src/assets/imgs/my/icon6@2x.png',
  386. iconActive: '/src/assets/imgs/my/icon6a@2x.png',
  387. show: true
  388. },
  389. {
  390. name: 'personalCenter.myWorkflow',
  391. path: '/personal-center/workflow',
  392. icon: '/src/assets/imgs/my/icon7@2x.png',
  393. iconActive: '/src/assets/imgs/my/icon7a@2x.png',
  394. show: true
  395. },
  396. {
  397. name: 'personalCenter.businessManagement',
  398. path: '/personal-center/business-management',
  399. icon: '/src/assets/imgs/my/icon8@2x.png',
  400. iconActive: '/src/assets/imgs/my/icon8a@2x.png',
  401. show: false
  402. },
  403. // {
  404. // name: 'personalCenter.serviceManagement',
  405. // path: '/personal-center/business-management',
  406. // icon: '/src/assets/imgs/my/icon9@2x.png',
  407. // iconActive: '/src/assets/imgs/my/icon9a@2x.png'
  408. // }
  409. ])
  410. const dialogVisible = ref(false)
  411. const show = ref(false)
  412. const tabs = ref([
  413. { label: 'personalCenter.tijiaogongdan', name: 0 },
  414. { label: 'personalCenter.lishigongdan', name: 1 },
  415. { label: 'personalCenter.changjianwenti', name: 2 }
  416. ])
  417. const workList = ref([])
  418. const workForm = ref({
  419. pageNum: 1,
  420. pageSize: 10,
  421. total: 0,
  422. })
  423. const activeName = ref(0)
  424. const workName = ref(null)
  425. const workTypeList = ref([
  426. {
  427. value: 'account',
  428. label: 'personalCenter.zhanghaowenti'
  429. },
  430. {
  431. value: 'payment',
  432. label: 'personalCenter.zhifuwenti'
  433. },
  434. {
  435. value: 'course',
  436. label: 'personalCenter.kechengwenti'
  437. },
  438. {
  439. value: 'workflow',
  440. label: 'personalCenter.gongzuoliuwenti'
  441. },
  442. {
  443. value: 'other',
  444. label: 'personalCenter.qitawenti'
  445. }
  446. ])
  447. const ruleForm = ref<RuleForm>({
  448. issueCategory: '',
  449. issueTitle: '',
  450. issueContent: ''
  451. })
  452. const rules = ref<FormRules<RuleForm>>({
  453. issueCategory: [
  454. {
  455. required: true,
  456. message: '请选择工单类型',
  457. trigger: 'change',
  458. },
  459. ],
  460. issueTitle: [
  461. { required: true, message: '请输入标题', trigger: 'blur' },
  462. ],
  463. issueContent: [
  464. { required: true, message: '请输入内容', trigger: 'blur' },
  465. ]
  466. })
  467. const navIndex = computed(() => {
  468. switch (route.name) {
  469. case 'Wallet':
  470. return 0
  471. break;
  472. case 'MemberDetails':
  473. return 1
  474. break;
  475. case 'Wallet':
  476. return 0
  477. break;
  478. case 'Collection':
  479. return 2
  480. break;
  481. case 'Demand':
  482. return 3
  483. break;
  484. case 'Orders':
  485. return 4
  486. break;
  487. case 'Invoice':
  488. return 5
  489. break;
  490. case 'Workflow':
  491. return 6
  492. break;
  493. case 'BusinessManagement':
  494. return 7
  495. break;
  496. default:
  497. break;
  498. }
  499. return null;
  500. })
  501. const userInfo = ref({})//用户信息
  502. const coverImage = ref([]);
  503. // 验证码倒计时
  504. const smsCountdown = ref(0)
  505. const passwordresetCountdown = ref(0)
  506. const emailCountdown = ref(0)
  507. // 发送短信验证码
  508. const sendSmsCode = async () => {
  509. if (!smsForm.account) {
  510. ElMessage.warning('请先输入手机号或邮箱')
  511. return
  512. }
  513. // 验证手机号格式
  514. if (!PHONE_REGEX.test(smsForm.account) && !EMAIL_REGEX.test(smsForm.account)) {
  515. ElMessage.warning('请输入正确的手机号或邮箱')
  516. return
  517. }
  518. let res = null;
  519. if (PHONE_REGEX.test(smsForm.account)) {
  520. res = await getSmsCode({
  521. phone: smsForm.account
  522. })
  523. } else if (EMAIL_REGEX.test(smsForm.account)) {
  524. res = await getEmailCode({
  525. email: smsForm.account
  526. })
  527. }
  528. if (res.code !== 200) {
  529. return
  530. }
  531. // 模拟发送验证码
  532. ElMessage.success('验证码发送成功')
  533. // 开始倒计时
  534. smsCountdown.value = 60
  535. const timer = setInterval(() => {
  536. smsCountdown.value--
  537. if (smsCountdown.value <= 0) {
  538. clearInterval(timer)
  539. }
  540. }, 1000)
  541. }
  542. const handlePageChange = (page) => {
  543. workForm.value.pageNum = page;
  544. getList()
  545. }
  546. const handleClick = async (tab) => {
  547. activeName.value = tab.props.name
  548. workForm.value.pageNum = 1;
  549. getList()
  550. }
  551. const getList = async () => {
  552. if (activeName.value == 0) return;
  553. let api = activeName.value == 1 ? issueList(workForm.value) : faqList(workForm.value);
  554. let res = await api;
  555. workList.value = res.rows;
  556. workForm.value.total = res.total;
  557. }
  558. const resetForm = () => {
  559. show.value = false;
  560. for (const key in ruleForm.value) {
  561. ruleForm.value[key] = ''
  562. }
  563. }
  564. const submitForm = async (formEl) => {
  565. if (!formEl) return;
  566. await formEl[0].validate(async (valid, fields) => {
  567. if (valid) {
  568. let res = await issue(ruleForm.value);
  569. if (res.code === 200) {
  570. resetForm();
  571. DGTMessage.success(`${t('common.submitSuccess')}`)
  572. }
  573. }
  574. })
  575. }
  576. // 更新用户信息
  577. const handleConfirm = async () => {
  578. let res = await updateUserInfo({
  579. nickName: userInfo.value.nickName,
  580. userAvatar: coverImage.value.map(item => item.url).join(';'),
  581. skillTags: dynamicTags.value.join(','),
  582. userPhone: userInfo.value.userPhone,
  583. })
  584. if (res.code === 200) {
  585. appStore.USERINFO();
  586. DGTMessage.success(`${t('common.modify')}${t('common.success')}`)
  587. dialogVisible.value = false;
  588. }
  589. }
  590. const toPath = (item: any, index: number) => {
  591. if (item.path) {
  592. router.push(item.path);
  593. }
  594. };
  595. // 签到
  596. const signIn = async () => {
  597. let res = await checkIn({ actionType: 1 });
  598. if (res.code === 200) {
  599. appStore.USERINFO();
  600. DGTMessage.success(`${t('personalCenter.checkIn')}${t('common.success')}`)
  601. }
  602. }
  603. // 获取用户信息
  604. const getInfo = async () => {
  605. let res = await getUserInfo();
  606. if (res?.user?.userAvatar) {
  607. coverImage.value = [{ url: res.user.userAvatar }]
  608. }
  609. if (res?.user?.skillTags) {
  610. dynamicTags.value = res.user.skillTags.split(',')
  611. }
  612. userInfo.value = res.user;
  613. navList.value.forEach(item => {
  614. if (item.name === 'personalCenter.businessManagement' && res.user.isCompanyAuth == 1) {
  615. item.show = true;
  616. }
  617. })
  618. // isCompanyAuth
  619. }
  620. const collectCount = ref(0)
  621. const inputValue = ref('')
  622. const dynamicTags = ref([])
  623. const inputVisible = ref(false)
  624. const InputRef = ref<InputInstance>()
  625. const handleClose = (tag: string) => {
  626. dynamicTags.value.splice(dynamicTags.value.indexOf(tag), 1)
  627. }
  628. const showInput = () => {
  629. inputVisible.value = true
  630. nextTick(() => {
  631. InputRef.value!.input!.focus()
  632. })
  633. }
  634. const handleInputConfirm = () => {
  635. if (inputValue.value) {
  636. dynamicTags.value.push(inputValue.value)
  637. }
  638. inputVisible.value = false
  639. inputValue.value = ''
  640. }
  641. const getCount = async () => {
  642. let res = await queryCollectCount();
  643. collectCount.value = res?.data?.collectCount;
  644. }
  645. onMounted(() => {
  646. getInfo()
  647. getCount()
  648. })
  649. </script>
  650. <style lang="scss" scoped>
  651. div {
  652. -webkit-user-select: none;
  653. /* Safari, Chrome */
  654. -moz-user-select: none;
  655. /* Firefox */
  656. -ms-user-select: none;
  657. /* IE 10+ */
  658. user-select: none;
  659. /* 标准语法 */
  660. }
  661. .personal-head {
  662. border-radius: 16px;
  663. padding: 24px 16px;
  664. background: #FFFFFF;
  665. display: flex;
  666. .personal-head-box {
  667. flex: 1;
  668. margin-left: 16px;
  669. }
  670. .personal-head-top {
  671. display: flex;
  672. align-items: center;
  673. justify-content: space-between;
  674. }
  675. .personal-head-bot {
  676. margin-top: 16px;
  677. display: flex;
  678. align-items: center;
  679. justify-content: space-between;
  680. .personal-user-list {
  681. display: flex;
  682. align-items: center;
  683. .btn {
  684. margin-left: 16px;
  685. }
  686. .personal-user-li {
  687. span {
  688. color: #333333;
  689. font-size: 14px;
  690. &:first-child {
  691. font-size: 28px;
  692. font-weight: bold;
  693. margin-right: 10px;
  694. }
  695. }
  696. }
  697. .personal-user-line {
  698. margin: 0 16px;
  699. height: 20px;
  700. width: 2px;
  701. background: #EBEEF5;
  702. }
  703. }
  704. }
  705. .personal-head-left {
  706. display: flex;
  707. .personal-user-info {
  708. .personal-username {
  709. display: flex;
  710. align-items: center;
  711. font-size: 18px;
  712. font-weight: bold;
  713. color: #333333;
  714. img {
  715. width: 68px;
  716. height: 21px;
  717. margin-left: 8px;
  718. }
  719. }
  720. }
  721. }
  722. .personal-head-right {
  723. display: flex;
  724. align-items: center;
  725. .personal-head-right-li {
  726. display: flex;
  727. padding: 9px 16px;
  728. align-items: center;
  729. margin-left: 8px;
  730. // height: 32px;
  731. background: #EAF0FF;
  732. border-radius: 4px;
  733. cursor: pointer;
  734. &:first-child {
  735. margin-left: 0;
  736. }
  737. &:last-child {
  738. background: linear-gradient(270deg, #0055FE 0%, #C832FA 100%);
  739. div {
  740. color: #FFFFFF;
  741. }
  742. }
  743. img {
  744. width: 14px;
  745. height: 14px;
  746. margin-right: 4px;
  747. }
  748. div {
  749. color: #2D71FF;
  750. font-size: 14px;
  751. }
  752. &:hover {
  753. opacity: 0.7;
  754. }
  755. }
  756. }
  757. }
  758. .personal-main {
  759. margin-top: 16px;
  760. display: flex;
  761. justify-content: space-between;
  762. .personal-left {
  763. width: 300px;
  764. .personal-left-list {
  765. background: #FFFFFF;
  766. border-radius: 16px;
  767. padding: 8px;
  768. .personal-left-li {
  769. height: 56px;
  770. display: flex;
  771. align-items: center;
  772. padding: 0 8px;
  773. font-size: 16px;
  774. color: #333333;
  775. cursor: pointer;
  776. border-radius: 8px;
  777. img {
  778. width: 20px;
  779. height: 20px;
  780. margin-right: 4px;
  781. }
  782. &:hover {
  783. background: #F5F7FF;
  784. }
  785. }
  786. .active {
  787. position: relative;
  788. background: #EAF0FF;
  789. &::after {
  790. top: 50%;
  791. transform: translateY(-50%);
  792. content: '';
  793. position: absolute;
  794. right: 8px;
  795. width: 4px;
  796. height: 24px;
  797. background: #2D71FF;
  798. border-radius: 2px;
  799. }
  800. div {
  801. color: #2D71FF;
  802. }
  803. }
  804. }
  805. }
  806. .personal-right {
  807. flex: 1;
  808. margin-left: 16px;
  809. .personal-right-main {
  810. padding: 0 16px;
  811. border-radius: 16px;
  812. background: #FFFFFF;
  813. }
  814. }
  815. }
  816. .tags {
  817. flex-wrap: wrap;
  818. gap: 16px;
  819. }
  820. .inputStyle {
  821. width: 368px;
  822. height: 36px;
  823. background: #F5F7FA;
  824. border-radius: 4px;
  825. border: 1px solid #F2F6FC;
  826. :deep(.el-input__wrapper) {
  827. background-color: transparent;
  828. }
  829. }
  830. .workOrder-dot {
  831. display: flex;
  832. cursor: pointer;
  833. align-items: center;
  834. justify-content: center;
  835. flex-direction: column;
  836. right: 80px;
  837. bottom: 70px;
  838. width: 84px;
  839. height: 84px;
  840. position: fixed;
  841. color: #2D71FF;
  842. font-size: 14px;
  843. background: #FFFFFF;
  844. box-shadow: 2px 2px 10px 0px rgba(45, 113, 255, 0.15);
  845. border-radius: 50px;
  846. img {
  847. width: 24px;
  848. height: 24px;
  849. }
  850. }
  851. .work-head {
  852. display: flex;
  853. color: #333333;
  854. font-size: 18px;
  855. font-weight: bold;
  856. align-items: center;
  857. img {
  858. width: 24px;
  859. height: 24px;
  860. margin-right: 8px;
  861. }
  862. }
  863. .work-content {
  864. padding: 16px;
  865. background: #F5F7FA;
  866. border-radius: 16px;
  867. color: #333333;
  868. line-height: 24px;
  869. font-size: 16px;
  870. display: flex;
  871. img {
  872. width: 24px;
  873. height: 24px;
  874. margin-right: 16px;
  875. }
  876. }
  877. :deep(.el-collapse-item__header) {
  878. padding: 0 8px;
  879. background-color: transparent;
  880. }
  881. :deep(.el-collapse-item__content) {
  882. padding: 0 16px 16px;
  883. }
  884. </style>