PersonalCenter.vue 36 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163
  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="`${ getImgUrl(`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="changeSHow" 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" class="gradient" @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"
  104. :placeholder="`${$t('personalCenter.gongdanleixing_placeholder')}`" 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"
  111. :placeholder="`${$t('personalCenter.gongdanbiaoti_placeholder')}`" />
  112. </el-form-item>
  113. <el-form-item :label="`${$t('personalCenter.gongdanneirong')}`" prop="issueContent">
  114. <el-input v-model="ruleForm.issueContent"
  115. :placeholder="`${$t('personalCenter.gongdanneirong_placeholder')}`" :rows="10" type="textarea" />
  116. </el-form-item>
  117. </el-form>
  118. </template>
  119. <template v-else>
  120. <el-collapse v-model="workName" accordion>
  121. <el-collapse-item :title="item.issueTitle || `${index + 1}、${item.question}`" :name="item.id"
  122. v-for="(item, index) in workList" :key="index">
  123. <template #title>
  124. <div class="work-head">
  125. <div class="work-head-left">
  126. <img v-if="activeName == 2" src="/src/assets/imgs/my/Q@2x.png" alt="">
  127. <div class="">{{ `${activeName == 2 ? (index + 1) + '、' : ''}` }}{{ item.issueTitle ||
  128. item.question }}</div>
  129. </div>
  130. <el-tag v-if="activeName == 1" :type="item.issueStatus == 2 ? 'success' : 'primary'">{{ item.issueStatus == 0 ?
  131. $t('personalCenter.daijiejue') : item.issueStatus == 2 ? $t('personalCenter.yijiejue') : ''
  132. }}</el-tag>
  133. </div>
  134. </template>
  135. <div class="work-content">
  136. <template v-if="activeName == 2">
  137. <img src="/src/assets/imgs/my/A@2x.png" alt="">
  138. <div class="">{{ item.issueContent || item.answer }}</div>
  139. </template>
  140. <el-descriptions style="width: 100%;" class="margin-top" :column="2" border v-else :label-width="langStore.currentLang == 'en' ? 180 : 80">
  141. <el-descriptions-item>
  142. <template #label>
  143. <div class="cell-item">{{ $t('personalCenter.gongdanbianhao') }}</div>
  144. </template>
  145. {{ item.issueNo }}
  146. </el-descriptions-item>
  147. <el-descriptions-item>
  148. <template #label>
  149. <div class="cell-item">{{ $t('personalCenter.gongdanzhuangtai') }}</div>
  150. </template>
  151. <el-tag :type="item.issueStatus == 2 ? 'success' : 'primary'">{{ item.issueStatus == 0 ?
  152. $t('personalCenter.daijiejue') : item.issueStatus == 2 ? $t('personalCenter.yijiejue') : ''
  153. }}</el-tag>
  154. </el-descriptions-item>
  155. <el-descriptions-item>
  156. <template #label>
  157. <div class="cell-item">{{ $t('personalCenter.gongdanleixing') }}</div>
  158. </template>
  159. {{ $t(getName(item.issueCategory)) }}
  160. </el-descriptions-item>
  161. <el-descriptions-item>
  162. <template #label>
  163. <div class="cell-item">{{ $t('personalCenter.gongdanbiaoti') }}</div>
  164. </template>
  165. {{ item.issueTitle }}
  166. </el-descriptions-item>
  167. <el-descriptions-item :span="2">
  168. <template #label>
  169. <div class="cell-item">{{ $t('personalCenter.gongdanneirong') }}</div>
  170. </template>
  171. {{ item.issueContent }}
  172. </el-descriptions-item>
  173. <el-descriptions-item :span="2" v-if="item.issueStatus == 2">
  174. <template #label>
  175. <div class="cell-item">{{ $t('personalCenter.gongdanhuifu') }}</div>
  176. </template>
  177. {{ item.remark }}
  178. </el-descriptions-item>
  179. </el-descriptions>
  180. </div>
  181. </el-collapse-item>
  182. </el-collapse>
  183. <template v-if="workList && workList.length">
  184. <Pagination :total="workForm.total" :page-size="workForm.pageSize" :current-page="workForm.pageNum"
  185. @page-change="handlePageChange" />
  186. </template>
  187. <el-empty v-else :description="$t('common.empty')" />
  188. </template>
  189. </el-tab-pane>
  190. </el-tabs>
  191. <template #footer v-if="activeName == 0">
  192. <div class="dialog-footer flex-center">
  193. <el-button @click="resetForm">{{ $t('common.cancel') }}</el-button>
  194. <el-button class="gradient" type="primary" @click="submitForm(ruleFormRef)">{{ $t('common.confirm')
  195. }}</el-button>
  196. </div>
  197. </template>
  198. </el-dialog>
  199. <el-dialog v-model="dialogVisible" :title="$t('personalCenter.editProfile')" width="784" :destroy-on-close="true">
  200. <el-form ref="userFormRef" :model="userInfo" label-width="auto" label-position="top" :rules="rules">
  201. <el-row :gutter="16">
  202. <el-col :span="24">
  203. <div class="flex-center">
  204. <el-form-item label="">
  205. <!-- $t('personalCenter.uploadAvatar') -->
  206. <!-- 图片类型 -->
  207. <FileUploader ref="fileUploader" accept="image/*" :multiple="false" :limit="1" :auto-upload="true"
  208. :isUploadAvatar="true"
  209. list-type="picture-card" :data="{ directory: 'workflow' }" buttonText="" v-model="coverImage" tip="" />
  210. </el-form-item>
  211. </div>
  212. </el-col>
  213. <el-col :span="12">
  214. <el-form-item :label="$t('personalCenter.nickName')" prop="nickName">
  215. <el-input v-model="userInfo.nickName" :placeholder="$t('personalCenter.pinickName')" class="inputStyle"
  216. :input-style="{
  217. backgroundColor: 'transparent',
  218. }" maxlength="15" />
  219. </el-form-item>
  220. </el-col>
  221. <el-col :span="12">
  222. <el-form-item :label="$t('personalCenter.loginPhone')">
  223. <el-input :disabled="appStore?.userInfo?.userPhone ? true : false" v-model="userInfo.userPhone"
  224. :placeholder="$t('workflowTradeAdd.placeholderPhoneNumber')" class="inputStyle" :input-style="{
  225. backgroundColor: 'transparent',
  226. }" />
  227. </el-form-item>
  228. </el-col>
  229. <el-col :span="12" v-if="!appStore?.userInfo?.userPhone">
  230. <el-form-item :label="$t('personalCenter.phoneCode')" prop="verifyCode">
  231. <el-input v-model="userInfo.verifyCode" maxlength="6" :placeholder="$t('login.placeholderCaptcha')"
  232. class="inputStyle" :input-style="{
  233. backgroundColor: 'transparent',
  234. }">
  235. <template #append>
  236. <el-button :disabled="smsCountdown > 0" @click="sendSmsCode" style="width:120px"
  237. :class="{ 'countdown-btn': smsCountdown > 0 }" size="small">
  238. {{ smsCountdown > 0 ? `${smsCountdown}s` : $t('login.sendCaptcha') }}
  239. </el-button>
  240. </template>
  241. </el-input>
  242. </el-form-item>
  243. </el-col>
  244. <el-col :span="12">
  245. <el-form-item :label="$t('personalCenter.loginEmail')">
  246. <el-input v-model="userInfo.email" :placeholder="$t('workflowTradeAdd.placeholderEmail')"
  247. class="inputStyle" :input-style="{
  248. backgroundColor: 'transparent',
  249. }" :disabled="appStore?.userInfo?.email ? true : false" />
  250. </el-form-item>
  251. </el-col>
  252. <el-col :span="12" v-if="!appStore?.userInfo?.email">
  253. <el-form-item :label="$t('personalCenter.emailCode')" prop="verifyCode">
  254. <el-input v-model="userInfo.verifyCode" maxlength="6" :placeholder="$t('login.placeholderCaptcha')"
  255. class="inputStyle" :input-style="{
  256. backgroundColor: 'transparent',
  257. }">
  258. <template #append>
  259. <el-button :disabled="smsCountdown > 0" @click="sendSmsCode" style="width:120px"
  260. :class="{ 'countdown-btn': smsCountdown > 0 }" size="small">
  261. {{ smsCountdown > 0 ? `${smsCountdown}s` : $t('login.sendCaptcha') }}
  262. </el-button>
  263. </template>
  264. </el-input>
  265. </el-form-item>
  266. </el-col>
  267. <el-col :span="12">
  268. <el-form-item :label="$t('personalCenter.n8nAccout')">
  269. <el-input disabled v-model="userInfo.n8nAccount" :placeholder="$t(!appStore?.userInfo?.email ? 'personalCenter.bdyxjcjzh' : 'personalCenter.createN8n')"
  270. class="inputStyle" :input-style="{
  271. backgroundColor: 'transparent',
  272. }">
  273. <template #append v-if="appStore?.userInfo?.email && !appStore?.userInfo?.n8nAccount">
  274. <el-tooltip class="box-item" effect="dark" :content="$t('personalCenter.ceraten8n')" placement="top">
  275. <el-button @click="createAi('0')" :icon="Refresh" />
  276. </el-tooltip>
  277. </template>
  278. </el-input>
  279. </el-form-item>
  280. </el-col>
  281. <el-col :span="12">
  282. <el-form-item :label="$t('personalCenter.n8nPassword')">
  283. <el-input v-model="userInfo.n8nPassword" :placeholder="$t('personalCenter.createN8n')" class="inputStyle"
  284. :input-style="{
  285. backgroundColor: 'transparent',
  286. }" readonly type="password" show-password />
  287. </el-form-item>
  288. </el-col>
  289. <el-col :span="12">
  290. <el-form-item :label="$t('personalCenter.cozeAccout')">
  291. <el-input disabled v-model="userInfo.cozeAccount" :placeholder="$t(!appStore?.userInfo?.email ? 'personalCenter.bdyxjcjzh' :'personalCenter.createCoze')"
  292. class="inputStyle" :input-style="{
  293. backgroundColor: 'transparent',
  294. }">
  295. <template #append v-if="appStore?.userInfo?.email && !appStore?.userInfo?.cozeAccount">
  296. <el-tooltip class="box-item" effect="dark" :content="$t('personalCenter.ceratenCoze')"
  297. placement="top">
  298. <el-button @click="createAi('1')" :icon="Refresh" />
  299. </el-tooltip>
  300. </template>
  301. </el-input>
  302. </el-form-item>
  303. </el-col>
  304. <el-col :span="12">
  305. <el-form-item :label="$t('personalCenter.cozePassword')">
  306. <el-input v-model="userInfo.cozePassword" :placeholder="$t('personalCenter.createCoze')"
  307. class="inputStyle" :input-style="{
  308. backgroundColor: 'transparent',
  309. }" readonly type="password" show-password />
  310. </el-form-item>
  311. </el-col>
  312. <el-col :span="12">
  313. <el-form-item :label="$t('personalCenter.difyAccout')">
  314. <el-input disabled v-model="userInfo.difyAccount" :placeholder="$t(!appStore?.userInfo?.email ? 'personalCenter.bdyxjcjzh' :'personalCenter.createDify')"
  315. class="inputStyle" :input-style="{
  316. backgroundColor: 'transparent',
  317. }">
  318. <template #append v-if="appStore?.userInfo?.email && !appStore?.userInfo?.difyAccount">
  319. <el-tooltip class="box-item" effect="dark" :content="$t('personalCenter.ceratenDify')"
  320. placement="top">
  321. <el-button @click="createAi('2')" :icon="Refresh" />
  322. </el-tooltip>
  323. </template>
  324. </el-input>
  325. </el-form-item>
  326. </el-col>
  327. <el-col :span="12">
  328. <el-form-item :label="$t('personalCenter.difyPassword')">
  329. <el-input v-model="userInfo.difyPassword" :placeholder="$t('personalCenter.createDify')"
  330. class="inputStyle" :input-style="{
  331. backgroundColor: 'transparent',
  332. }" readonly type="password" show-password />
  333. </el-form-item>
  334. </el-col>
  335. <el-col :span="12">
  336. <el-form-item :label="$t('personalCenter.fastGptAccout')">
  337. <el-input disabled v-model="userInfo.fastGptAccount" :placeholder="$t(!appStore?.userInfo?.email ? 'personalCenter.bdyxjcjzh' :'personalCenter.createFastGpt')"
  338. class="inputStyle" :input-style="{
  339. backgroundColor: 'transparent',
  340. }">
  341. <template #append v-if="appStore?.userInfo?.email && !appStore?.userInfo?.fastGptAccount">
  342. <el-tooltip class="box-item" effect="dark" :content="$t('personalCenter.ceratenFastGpt')"
  343. placement="top">
  344. <el-button @click="createAi('3')" :icon="Refresh" />
  345. </el-tooltip>
  346. </template>
  347. </el-input>
  348. </el-form-item>
  349. </el-col>
  350. <el-col :span="12">
  351. <el-form-item :label="$t('personalCenter.fastGptPassword')">
  352. <el-input v-model="userInfo.fastGptPassword" :placeholder="$t('personalCenter.createFastGpt')"
  353. class="inputStyle" :input-style="{
  354. backgroundColor: 'transparent',
  355. }" readonly type="password" show-password />
  356. </el-form-item>
  357. </el-col>
  358. </el-row>
  359. <el-row>
  360. <el-col :span="24">
  361. <el-form-item :label="`${$t('personalCenter.skillTag')}(${ $t('personalCenter.zdtjwg') })`">
  362. <div class="flex tags flex_1">
  363. <el-tag v-for="tag in dynamicTags" :key="tag" closable @close="handleClose(tag)">
  364. {{ tag }}
  365. </el-tag>
  366. <template v-if="dynamicTags.length < 5">
  367. <el-input v-if="inputVisible" ref="InputRef" v-model="inputValue" class="w-20" size="small"
  368. @keyup.enter="handleInputConfirm" @blur="handleInputConfirm" maxlength="5" show-word-limit :placeholder="
  369. $t('personalCenter.psrjnbq')
  370. ">
  371. <template #append>
  372. <el-button :icon="Plus" />
  373. </template></el-input>
  374. <el-button v-else class="button-new-tag" size="small" @click="showInput">
  375. + {{ $t('common.addTags') }}
  376. </el-button>
  377. </template>
  378. </div>
  379. </el-form-item>
  380. </el-col>
  381. </el-row>
  382. </el-form>
  383. <template #footer>
  384. <div class="dialog-footer flex-center">
  385. <el-button @click="userInfo = {}, dialogVisible = false">{{ $t('common.cancel') }}</el-button>
  386. <el-button class="gradient" type="primary" @click="handleConfirm(userFormRef)">
  387. {{ $t('common.confirm') }}
  388. </el-button>
  389. </div>
  390. </template>
  391. </el-dialog>
  392. </div>
  393. </template>
  394. <script setup lang="ts">
  395. import { Plus, Refresh } from '@element-plus/icons-vue'
  396. import { useAppStore } from '@/pinia/appStore'
  397. import { ref, onMounted, computed, nextTick } from 'vue';
  398. import type { InputInstance } from 'element-plus'
  399. import { useRoute, useRouter } from 'vue-router'
  400. import { getUserInfo, updateUserInfo, getSmsCode, getEmailCode,sendBindCode } from '@/api/auth.js'
  401. import { checkIn, queryCollectCount, issue, issueList, faqList, getfaq, createAiAccount } from '@/api/my.js'
  402. import DGTMessage from '@/utils/message'
  403. import { useI18n } from 'vue-i18n'
  404. import FileUploader from '@/components/FileUploader.vue'
  405. import Pagination from '@/components/Pagination.vue'
  406. import type { FormInstance, FormRules } from 'element-plus'
  407. import { useLangStore } from '@/pinia/langStore'
  408. const langStore = useLangStore();
  409. interface RuleForm {
  410. issueCategory: string
  411. issueTitle: string
  412. issueContent: string
  413. }
  414. const ruleFormRef = ref(null);
  415. const userFormRef = ref();
  416. const { t } = useI18n()
  417. const appStore = useAppStore();
  418. const route = useRoute()
  419. const router = useRouter()
  420. const getImgUrl = (path) => {
  421. return new URL(`/src/assets/imgs/my/${path}`, import.meta.url).href
  422. }
  423. const navList = ref([
  424. {
  425. name: 'personalCenter.myWallet',
  426. path: '/personal-center/wallet',
  427. icon: getImgUrl('icon1@2x.png'),
  428. iconActive: getImgUrl('icon1a@2x.png'),
  429. show: true
  430. },
  431. {
  432. name: 'personalCenter.membershipInfo',
  433. path: '/personal-center/member-details',
  434. icon: getImgUrl('icon2@2x.png'),
  435. iconActive: getImgUrl('icon2a@2x.png'),
  436. show: true
  437. },
  438. {
  439. name: 'personalCenter.myCollection',
  440. path: '/personal-center/collection',
  441. icon: getImgUrl('icon3@2x.png'),
  442. iconActive: getImgUrl('icon3a@2x.png'),
  443. show: true
  444. },
  445. {
  446. name: 'personalCenter.myDemand',
  447. path: '/personal-center/demand',
  448. icon: getImgUrl('icon4@2x.png'),
  449. iconActive: getImgUrl('icon4a@2x.png'),
  450. show: true
  451. },
  452. {
  453. name: 'personalCenter.myOrders',
  454. path: '/personal-center/orders',
  455. icon: getImgUrl('icon5@2x.png'),
  456. iconActive: getImgUrl('icon5a@2x.png'),
  457. show: true
  458. },
  459. {
  460. name: 'personalCenter.myInvoice',
  461. path: '/personal-center/invoice',
  462. icon: getImgUrl('icon6@2x.png'),
  463. iconActive: getImgUrl('icon6a@2x.png'),
  464. show: true
  465. },
  466. {
  467. name: 'personalCenter.myWorkflow',
  468. path: '/personal-center/workflow',
  469. icon: getImgUrl('icon7@2x.png'),
  470. iconActive: getImgUrl('icon7a@2x.png'),
  471. show: true
  472. },
  473. {
  474. name: 'personalCenter.businessManagement',
  475. path: '/personal-center/business-management',
  476. icon: getImgUrl('icon8@2x.png'),
  477. iconActive: getImgUrl('icon8a@2x.png'),
  478. show: false
  479. },
  480. // {
  481. // name: 'personalCenter.serviceManagement',
  482. // path: '/personal-center/business-management',
  483. // icon: '/src/assets/imgs/my/icon9@2x.png',
  484. // iconActive: '/src/assets/imgs/my/icon9a@2x.png'
  485. // }
  486. ])
  487. const dialogVisible = ref(false)
  488. const show = ref(false)
  489. const tabs = ref([
  490. { label: 'personalCenter.tijiaogongdan', name: 0 },
  491. { label: 'personalCenter.lishigongdan', name: 1 },
  492. { label: 'personalCenter.changjianwenti', name: 2 }
  493. ])
  494. const workList = ref([])
  495. const workForm = ref({
  496. pageNum: 1,
  497. pageSize: 10,
  498. total: 0,
  499. })
  500. const activeName = ref(0)
  501. const workName = ref(null)
  502. const workTypeList = ref([
  503. {
  504. value: 'account',
  505. label: 'personalCenter.zhanghaowenti'
  506. },
  507. {
  508. value: 'payment',
  509. label: 'personalCenter.zhifuwenti'
  510. },
  511. {
  512. value: 'course',
  513. label: 'personalCenter.kechengwenti'
  514. },
  515. {
  516. value: 'workflow',
  517. label: 'personalCenter.gongzuoliuwenti'
  518. },
  519. {
  520. value: 'other',
  521. label: 'personalCenter.qitawenti'
  522. }
  523. ])
  524. // 获取工单分类
  525. const getName = (value) => {
  526. let txt = ''
  527. workTypeList.value.forEach(item => {
  528. if (item.value == value) {
  529. txt = item.label
  530. }
  531. })
  532. return txt
  533. }
  534. const ruleForm = ref<RuleForm>({
  535. issueCategory: '',
  536. issueTitle: '',
  537. issueContent: ''
  538. })
  539. const rules = ref<FormRules<RuleForm>>({
  540. issueCategory: [
  541. {
  542. required: true,
  543. message: t('personalCenter.gongdanleixing_placeholder'),
  544. trigger: 'change',
  545. },
  546. ],
  547. issueTitle: [
  548. { required: true, message: t('personalCenter.gongdanbiaoti_placeholder'), trigger: 'blur' },
  549. ],
  550. issueContent: [
  551. { required: true, message: t('personalCenter.gongdanneirong_placeholder'), trigger: 'blur' },
  552. ],
  553. nickName: [
  554. {
  555. required: true, message: t('personalCenter.pinickName'), trigger: 'blur'
  556. }
  557. ]
  558. })
  559. const navIndex = computed(() => {
  560. switch (route.name) {
  561. case 'Wallet':
  562. return 0
  563. break;
  564. case 'MemberDetails':
  565. return 1
  566. break;
  567. case 'Wallet':
  568. return 0
  569. break;
  570. case 'Collection':
  571. return 2
  572. break;
  573. case 'Demand':
  574. return 3
  575. break;
  576. case 'Orders':
  577. return 4
  578. break;
  579. case 'Invoice':
  580. return 5
  581. break;
  582. case 'Workflow':
  583. return 6
  584. break;
  585. case 'BusinessManagement':
  586. return 7
  587. break;
  588. default:
  589. break;
  590. }
  591. return null;
  592. })
  593. const userInfo = ref({})//用户信息
  594. const coverImage = ref([]);
  595. // 验证码倒计时
  596. const smsCountdown = ref(0)
  597. const passwordresetCountdown = ref(0)
  598. const emailCountdown = ref(0)
  599. // 正则表达式
  600. const PHONE_REGEX = /^1[3-9]\d{9}$/;
  601. // 优化后的邮箱正则(兼顾准确性和实用性)
  602. const EMAIL_REGEX = /^[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$/;
  603. const isPasswordPhone = computed(() => {
  604. return PHONE_REGEX.test(passwordForm.account);
  605. });
  606. const isPasswordEmail = computed(() => {
  607. return EMAIL_REGEX.test(passwordForm.account);
  608. });
  609. // 创建ai相关账号
  610. const createAi = async (creatFlag) => {
  611. let res = await createAiAccount({ creatFlag });
  612. if (res.code === 200) {
  613. if (creatFlag == '0') {
  614. userInfo.value.n8nAccount = res.data.n8nAccount;
  615. userInfo.value.n8nPassword = res.data.n8nPassword;
  616. } else if (creatFlag == '1') {
  617. userInfo.value.cozeAccount = res.data.cozeAccount;
  618. userInfo.value.cozePassword = res.data.cozePassword;
  619. } else if (creatFlag == '2') {
  620. userInfo.value.difyAccount = res.data.difyAccount;
  621. userInfo.value.difyPassword = res.data.difyPassword;
  622. } else if (creatFlag == '3') {
  623. userInfo.value.fastGptAccount = res.data.fastGptAccount;
  624. userInfo.value.fastGptPassword = res.data.fastGptPassword;
  625. }
  626. appStore.USERINFO();
  627. DGTMessage.success(`${t('common.success')}`)
  628. }
  629. }
  630. // 发送短信验证码
  631. const sendSmsCode = async () => {
  632. let account = appStore?.userInfo?.userPhone ? userInfo.value.email : userInfo.value.userPhone
  633. if (!account) {
  634. DGTMessage.warning(appStore?.userInfo?.userPhone ? t('workflowTradeAdd.placeholderEmail') : t('workflowTradeAdd.placeholderPhoneNumber'))
  635. return
  636. }
  637. // 验证手机号格式
  638. if ((!PHONE_REGEX.test(account) && appStore?.userInfo?.email) || (!EMAIL_REGEX.test(account) && appStore?.userInfo?.userPhone)) {
  639. DGTMessage.warning(appStore?.userInfo?.userPhone ? t('common.pleaseInputRightEmail') : t('common.pleaseInputRightPhoneNumber'))
  640. return
  641. }
  642. let res = await sendBindCode({
  643. account: account,
  644. type: appStore?.userInfo?.userPhone ? 'email' : 'phone'
  645. });
  646. if (res.code !== 200) {
  647. return
  648. }
  649. // 模拟发送验证码
  650. DGTMessage.success(t('login.captchaSendSuccess'))
  651. // 开始倒计时
  652. smsCountdown.value = 60
  653. const timer = setInterval(() => {
  654. smsCountdown.value--
  655. if (smsCountdown.value <= 0) {
  656. clearInterval(timer)
  657. }
  658. }, 1000)
  659. }
  660. const handlePageChange = (page, pageSize) => {
  661. workForm.value.pageNum = page;
  662. if(pageSize)workForm.value.pageSize = pageSize;
  663. getList()
  664. }
  665. const handleClick = async (tab) => {
  666. activeName.value = tab.props.name
  667. workForm.value.pageNum = 1;
  668. getList()
  669. }
  670. const getList = async () => {
  671. if (activeName.value == 0) return;
  672. let api = activeName.value == 1 ? issueList(workForm.value) : faqList(workForm.value);
  673. let res = await api;
  674. workList.value = res.rows;
  675. workForm.value.total = res.total;
  676. }
  677. const resetForm = () => {
  678. show.value = false;
  679. for (const key in ruleForm.value) {
  680. ruleForm.value[key] = ''
  681. }
  682. }
  683. const submitForm = async (formEl) => {
  684. if (!formEl) return;
  685. await formEl[0].validate(async (valid, fields) => {
  686. if (valid) {
  687. let res = await issue(ruleForm.value);
  688. if (res.code === 200) {
  689. resetForm();
  690. DGTMessage.success(`${t('common.submitSuccess')}`)
  691. }
  692. }
  693. })
  694. }
  695. // 更新用户信息
  696. const handleConfirm = async (formEl) => {
  697. if (!formEl) return
  698. await formEl.validate(async (valid, fields) => {
  699. if (valid) {
  700. if (!appStore.userInfo.userPhone || !appStore.userInfo.email) {
  701. userInfo.value.bindType = appStore.userInfo.userPhone ? 'email' : 'phone'
  702. }
  703. let obj = !appStore.userInfo.userPhone && userInfo.value.userPhone || !appStore.userInfo.email && userInfo.value.email ? { email: userInfo.value.email, bindType: userInfo.value.bindType, userPhone: userInfo.value.userPhone, verifyCode: userInfo.value.verifyCode } : {}
  704. let res = await updateUserInfo({
  705. nickName: userInfo.value.nickName,
  706. userAvatar: coverImage.value.map(item => item.url).join(';'),
  707. skillTags: dynamicTags.value.join(','),
  708. ...obj
  709. })
  710. if (res.code === 200) {
  711. appStore.USERINFO();
  712. DGTMessage.success(`${t('common.modify')}${t('common.success')}`)
  713. dialogVisible.value = false;
  714. }
  715. }
  716. })
  717. }
  718. const toPath = (item: any, index: number) => {
  719. if (item.path) {
  720. router.push(item.path);
  721. }
  722. };
  723. // 签到
  724. const signIn = async () => {
  725. let res = await checkIn({ actionType: 1 });
  726. if (res.code === 200) {
  727. appStore.USERINFO();
  728. DGTMessage.success(`${t('personalCenter.checkIn')}${t('common.success')}`)
  729. }
  730. }
  731. // 获取用户信息
  732. const getInfo = async () => {
  733. let res = await getUserInfo();
  734. if (res?.user?.userAvatar) {
  735. coverImage.value = [{ url: res.user.userAvatar }]
  736. }
  737. if (res?.user?.skillTags) {
  738. dynamicTags.value = res.user.skillTags.split(',')
  739. } else {
  740. dynamicTags.value = []
  741. }
  742. userInfo.value = res.user;
  743. navList.value.forEach(item => {
  744. if (item.name === 'personalCenter.businessManagement' && res?.user?.isCompanyAuth == 1) {
  745. item.show = true;
  746. }
  747. })
  748. }
  749. const collectCount = ref(0)
  750. const inputValue = ref('')
  751. const dynamicTags = ref([])
  752. const inputVisible = ref(false)
  753. const InputRef = ref<InputInstance>()
  754. const handleClose = (tag: string) => {
  755. dynamicTags.value.splice(dynamicTags.value.indexOf(tag), 1)
  756. }
  757. const showInput = () => {
  758. inputVisible.value = true
  759. nextTick(() => {
  760. InputRef.value!.input!.focus()
  761. })
  762. }
  763. const handleInputConfirm = () => {
  764. if (inputValue.value) {
  765. dynamicTags.value.push(inputValue.value)
  766. }
  767. inputVisible.value = false
  768. inputValue.value = ''
  769. }
  770. const getCount = async () => {
  771. let res = await queryCollectCount();
  772. collectCount.value = res?.data?.collectCount;
  773. }
  774. const changeSHow = async () => {
  775. await getInfo()
  776. dialogVisible.value = true;
  777. }
  778. onMounted(() => {
  779. getInfo()
  780. getCount()
  781. })
  782. </script>
  783. <style lang="scss" scoped>
  784. div {
  785. -webkit-user-select: none;
  786. /* Safari, Chrome */
  787. -moz-user-select: none;
  788. /* Firefox */
  789. -ms-user-select: none;
  790. /* IE 10+ */
  791. user-select: none;
  792. /* 标准语法 */
  793. }
  794. .personal-head {
  795. border-radius: 16px;
  796. padding: 24px 16px;
  797. background: #FFFFFF;
  798. display: flex;
  799. .personal-head-box {
  800. flex: 1;
  801. margin-left: 16px;
  802. }
  803. .personal-head-top {
  804. display: flex;
  805. align-items: center;
  806. justify-content: space-between;
  807. }
  808. .personal-head-bot {
  809. margin-top: 16px;
  810. display: flex;
  811. align-items: center;
  812. justify-content: space-between;
  813. .personal-user-list {
  814. display: flex;
  815. align-items: center;
  816. .btn {
  817. margin-left: 16px;
  818. }
  819. .personal-user-li {
  820. span {
  821. color: #333333;
  822. font-size: 14px;
  823. &:first-child {
  824. font-size: 28px;
  825. font-weight: bold;
  826. margin-right: 10px;
  827. }
  828. }
  829. }
  830. .personal-user-line {
  831. margin: 0 16px;
  832. height: 20px;
  833. width: 2px;
  834. background: #EBEEF5;
  835. }
  836. }
  837. }
  838. .personal-head-left {
  839. display: flex;
  840. .personal-user-info {
  841. .personal-username {
  842. display: flex;
  843. align-items: center;
  844. font-size: 18px;
  845. font-weight: bold;
  846. color: #333333;
  847. img {
  848. width: 68px;
  849. height: 21px;
  850. margin-left: 8px;
  851. }
  852. }
  853. }
  854. }
  855. .personal-head-right {
  856. display: flex;
  857. align-items: center;
  858. .personal-head-right-li {
  859. display: flex;
  860. padding: 9px 16px;
  861. align-items: center;
  862. margin-left: 8px;
  863. // height: 32px;
  864. background: #EAF0FF;
  865. border-radius: 4px;
  866. cursor: pointer;
  867. &:first-child {
  868. margin-left: 0;
  869. }
  870. &:last-child {
  871. background: linear-gradient(270deg, #0055FE 0%, #C832FA 100%);
  872. div {
  873. color: #FFFFFF;
  874. }
  875. }
  876. img {
  877. width: 14px;
  878. height: 14px;
  879. margin-right: 4px;
  880. }
  881. div {
  882. color: #2D71FF;
  883. font-size: 14px;
  884. }
  885. &:hover {
  886. opacity: 0.7;
  887. }
  888. }
  889. }
  890. }
  891. .personal-main {
  892. margin-top: 16px;
  893. display: flex;
  894. justify-content: space-between;
  895. .personal-left {
  896. width: 300px;
  897. .personal-left-list {
  898. background: #FFFFFF;
  899. border-radius: 16px;
  900. padding: 8px;
  901. .personal-left-li {
  902. height: 56px;
  903. display: flex;
  904. align-items: center;
  905. padding: 0 8px;
  906. font-size: 16px;
  907. color: #333333;
  908. cursor: pointer;
  909. border-radius: 8px;
  910. img {
  911. width: 20px;
  912. height: 20px;
  913. margin-right: 4px;
  914. }
  915. &:hover {
  916. background: #F5F7FF;
  917. }
  918. }
  919. .active {
  920. position: relative;
  921. background: #EAF0FF;
  922. &::after {
  923. top: 50%;
  924. transform: translateY(-50%);
  925. content: '';
  926. position: absolute;
  927. right: 8px;
  928. width: 4px;
  929. height: 24px;
  930. background: #2D71FF;
  931. border-radius: 2px;
  932. }
  933. div {
  934. color: #2D71FF;
  935. }
  936. }
  937. }
  938. }
  939. .personal-right {
  940. flex: 1;
  941. margin-left: 16px;
  942. .personal-right-main {
  943. padding: 0 16px;
  944. border-radius: 16px;
  945. background: #FFFFFF;
  946. min-height: calc(100vh - 350px);
  947. }
  948. }
  949. }
  950. .tags {
  951. flex-wrap: wrap;
  952. gap: 16px;
  953. }
  954. .inputStyle {
  955. width: 368px;
  956. height: 36px;
  957. background: #F5F7FA;
  958. border-radius: 4px;
  959. border: 1px solid #F2F6FC;
  960. }
  961. .workOrder-dot {
  962. display: flex;
  963. cursor: pointer;
  964. align-items: center;
  965. justify-content: center;
  966. flex-direction: column;
  967. right: 80px;
  968. bottom: 70px;
  969. width: 84px;
  970. height: 84px;
  971. position: fixed;
  972. color: #2D71FF;
  973. font-size: 14px;
  974. background: #FFFFFF;
  975. box-shadow: 2px 2px 10px 0px rgba(45, 113, 255, 0.15);
  976. border-radius: 50px;
  977. img {
  978. width: 24px;
  979. height: 24px;
  980. }
  981. }
  982. .work-head {
  983. display: flex;
  984. color: #333333;
  985. font-size: 18px;
  986. font-weight: bold;
  987. align-items: center;
  988. justify-content: space-between;
  989. .work-head-left {
  990. display: flex;
  991. align-items: center;
  992. }
  993. img {
  994. width: 24px;
  995. height: 24px;
  996. margin-right: 8px;
  997. }
  998. }
  999. .work-content {
  1000. padding: 16px;
  1001. background: #F5F7FA;
  1002. border-radius: 16px;
  1003. color: #333333;
  1004. line-height: 24px;
  1005. font-size: 16px;
  1006. display: flex;
  1007. img {
  1008. width: 24px;
  1009. height: 24px;
  1010. margin-right: 16px;
  1011. }
  1012. }
  1013. :deep(.el-collapse-item__header) {
  1014. padding: 0 8px;
  1015. background-color: transparent;
  1016. }
  1017. :deep(.el-collapse-item__content) {
  1018. padding: 0 16px 16px;
  1019. }
  1020. .w-20 {
  1021. width: 200px;
  1022. }
  1023. </style>