myuser.vue 47 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659
  1. <template>
  2. <view class="wanlgroups-user-container">
  3. <image class="pagebg" :src="pagebgImage" mode="widthFix">
  4. </image>
  5. <view class="wanlgroups-user-container__head" :style="{ height: headHeight + 'px' }">
  6. <view class="background" v-if="headerOpacity > 0" :style="{
  7. height: headHeight + 'px',
  8. opacity: headerOpacity,
  9. backgroundColor: '#9efeff'
  10. }">
  11. <view class="bgcolor"></view>
  12. </view>
  13. <view class="navigater text-black" :style="{
  14. height: headHeight + 'px',
  15. paddingTop: headTop + 'px'
  16. }">
  17. <view class="text-xl">
  18. <view v-if="fromUserPage" class="margin-right">
  19. <text class="wlIcon-fanhui1 text-bold" @tap="handleBack"></text>
  20. </view>
  21. <view class="text-cut" style="width: 100rpx;">
  22. <text class="text-lg" v-if="headerOpacity > 0" :style="{ opacity: headerOpacity }">
  23. {{ userData.user.nickname }}
  24. </text>
  25. </view>
  26. </view>
  27. <view class="text-xl">
  28. <text v-if="headerOpacity > 0 && $store.state.user.isLogin && !isMyfind && userData.isFollow === 0"
  29. :style="{ opacity: headerOpacity }" class="margin-right text-sm"
  30. @tap="handleFollow(userData.shop)">
  31. + {{$t('user.follow')}}
  32. </text>
  33. <!-- 隐藏分享 -->
  34. <!-- <text class="wlIcon-fenxiangcopy margin-right-xl text-bold" @tap="showModal('share')" /> -->
  35. <!-- <text class="wlIcon-gengduo text-bold" @tap="showModal('menu')" /> -->
  36. <text class="wlIcon-gengduo text-bold" @tap="$appKit.auth('/pages/user/setting/setting')" />
  37. </view>
  38. </view>
  39. </view>
  40. <!-- 主体 -->
  41. <view class="wanlgroups-user-container__main">
  42. <view class="head text-black" :style="{ paddingTop: headHeight + 'px' }" @click="handleTheme">
  43. <!-- 未登录状态 -->
  44. <block v-if="!$store.state.user.isLogin">
  45. <view class="userinfo" @click.stop="$appKit.to('/pages/user/auth/newpreLogin')">
  46. <view class="cu-avatar margin-right-bj round" :style="{
  47. backgroundImage: `url(${$appKit.oss('', 88, 88)})`
  48. }" />
  49. <view class="flex-sub">
  50. <view class="mz">{{ $t('user.loginRegister') }}</view>
  51. <!-- <view class="txt mt-1">
  52. {{ $t('user.welcomeLogin') }}
  53. </view> -->
  54. </view>
  55. </view>
  56. <view class="qianming px-3">
  57. <!-- <text>{{ $t('user.welcomeLogin') }}</text> -->
  58. </view>
  59. <view class="findinfo margin-top">
  60. <view class="flex align-center">
  61. <view class="quantity flex flex-1 justify-around">
  62. <view class="project">
  63. <text class="num">0</text>
  64. <text class="mz ml-0_5">{{$t('user.follow')}}</text>
  65. </view>
  66. <view class="project">
  67. <text class="num">0</text>
  68. <text class="mz ml-0_5">{{$t('user.followers')}}</text>
  69. </view>
  70. <view class="project">
  71. <text class="num">0</text>
  72. <text class="mz ml-0_5">{{$t('user.liked')}}</text>
  73. </view>
  74. </view>
  75. <view>
  76. <button class="cu-btn anniu-btn mr-2"
  77. @click.stop="$appKit.to('/pages/user/auth/newpreLogin')">
  78. {{ $t('user.loginRegister') }}
  79. </button>
  80. </view>
  81. </view>
  82. <view class="jieshao">
  83. {{ $t('user.welcomeLogin') }}
  84. <!-- 元嘉草草,封狼居胥,赢得仓皇北顾。四十三年,望中犹记,烽火扬州路。可堪回首,佛狸祠下,一片神鸦社鼓。凭谁问:廉颇老矣,尚能饭否?... -->
  85. </view>
  86. </view>
  87. </block>
  88. <!-- 已登录状态 -->
  89. <block v-else>
  90. <view class="userinfo">
  91. <view class="userinfo-main">
  92. <view class="cu-avatar margin-right-bj round" :style="{
  93. backgroundImage: `url(${$appKit.oss(userData.user.avatar, 88, 88)})`
  94. }" />
  95. <view class="flex-sub">
  96. <view class="mz">{{ userData.user.nickname }}</view>
  97. <view class="txt">
  98. <view class="flex-direction" v-if="userData.user_no">
  99. <text>{{$t('user.account-number')}}</text>
  100. <text>{{ userData.user_no }}</text>
  101. <text class="wlIcon-fuzhi margin-left-sm"
  102. @click.stop="$appKit.copy(userData.user_no)"></text>
  103. </view>
  104. </view>
  105. </view>
  106. <!-- 开启直播按钮 - 移动到个人信息区域右侧 -->
  107. <button v-if="isMyfind" class="cu-btn anniu-btn " @click.stop="handleStartLive">
  108. <text>{{$t('start-live')}}</text>
  109. </button>
  110. </view>
  111. <!-- 个性签名放在头像下面,与头像左边齐平 -->
  112. <view class="qianming">
  113. <text>{{ userData.user.bio || $t('user.no-signature') }}</text>
  114. <text v-if="isMyfind" class="wlIcon-jifen margin-left-xs" @click.stop="handleUserEdit"></text>
  115. </view>
  116. </view>
  117. </block>
  118. <view v-if="$store.state.user.isLogin" class="findinfo bg-white " @tap.stop="">
  119. <!-- 粉丝信息 -->
  120. <view class="flex align-center">
  121. <view class="quantity flex flex-1 justify-around">
  122. <view class="project" @click.stop="
  123. $appKit.auth(`/pages/apps/find/user/follow?id=${userData.user_no}`)
  124. ">
  125. <text class="num">
  126. {{ $appKit.toFormat( userData.follow < 0 ? 0 : userData.follow, 'thousand' ) }}
  127. </text>
  128. <text class="mz ml-0_5">{{$t('user.follow')}}</text>
  129. </view>
  130. <view class="project" @click.stop="
  131. $appKit.auth(`/pages/apps/find/user/fans?id=${userData.user_no}`)
  132. ">
  133. <text class="num">
  134. {{ $appKit.toFormat( userData.fans < 0 ? 0 : userData.fans, 'thousand' ) }}
  135. </text>
  136. <text class="mz ml-0_5">{{$t('user.followers')}}</text>
  137. </view>
  138. <view class="project" @click.stop="showModal('praised')">
  139. <text class="num">
  140. {{ $appKit.toFormat( userData.praised < 0 ? 0 : userData.praised, 'thousand' ) }}
  141. </text>
  142. <text class="mz ml-0_5">{{$t('user.liked')}}</text>
  143. </view>
  144. </view>
  145. <view>
  146. <button v-if="isMyfind" class="cu-btn anniu-btn mr-2" @click.stop="handleUserEdit">
  147. {{$t('edit_profile')}}
  148. </button>
  149. <block v-else>
  150. <block v-if="loadingFollow">
  151. <button v-if="userData.isFollow === 0" class="cu-btn round line-white">
  152. <text class="wlIcon-jiazai1 wlIconfont-spin margin-right-xs"></text>
  153. {{$t('user.following-ellipsis')}}
  154. </button>
  155. <button v-else class="cu-btn round line-white">
  156. <text class="wlIcon-jiazai1 wlIconfont-spin margin-right-xs"></text>
  157. {{$t('user.unfollowing-ellipsis')}}
  158. </button>
  159. </block>
  160. <block v-else>
  161. <button v-if="userData.isFollow === 0" class="cu-btn round line-white"
  162. @click.stop="handleFollow(userData.shop)">
  163. <text class="wlIcon-tianjia margin-right-xs"></text>
  164. {{$t('user.follow')}}
  165. </button>
  166. <button v-else class="cu-btn round line-white"
  167. @click.stop="handleFollow(userData.shop)">
  168. {{$t('user.followed')}}
  169. </button>
  170. </block>
  171. </block>
  172. </view>
  173. </view>
  174. <!-- 用户资产信息(仅本人显示) -->
  175. <view v-if="isMyfind" class="user-assets solid-top margin-top padding-top" @tap.stop="">
  176. <view class="project text-sm wanl-gray-dark">
  177. <!-- <view style="line-height: 1.8;" @tap.stop="$appKit.auth('/pages/user/coupon/mycard')">
  178. <view class="wanl-pip text-lg text-bold6">{{ $store.state.statistics.dynamic.coupon || 0 }}</view>
  179. {{ $t('user.myCards') }}
  180. </view> -->
  181. <view style="line-height: 1.8;" @tap.stop="$appKit.auth('/pages/user/money/money')">
  182. <view class="wanl-pip text-lg text-bold6">{{ user.money ? user.money : '0.00' }}</view>
  183. {{ $t('user.balance') }}
  184. </view>
  185. <view style="line-height: 1.8;" @tap.stop="$appKit.auth('/pages/user/money/diamond-top-up')">
  186. <view class="wanl-pip text-lg text-bold6">{{ diamondBalance !== null ? diamondBalance.toFixed(2) : '0.00' }}</view>
  187. {{ $t('money.diamond') }}
  188. </view>
  189. <view class="solid-left bill-details-center" style="line-height: 1.8;" @tap.stop="$appKit.auth('/pages/user/money/tipwallet')">
  190. <view class="wanl-pip text-lg text-bold6">{{ tipWallet !== null ? tipWallet : '0.00' }}</view>
  191. {{ $t('user.tipWallet') }}
  192. </view>
  193. </view>
  194. </view>
  195. </view>
  196. <view v-if="$store.state.user.isLogin && userData.shop"
  197. class="shopinfo margin-top-bj solid-top padding-top-bj" @click.stop="onShop(userData.shop.id)">
  198. <view class="cu-avatar margin-right-bj round"
  199. :style="{ backgroundImage: `url(${$appKit.oss(userData.shop.avatar, 88, 88)})` }" />
  200. <view class="subject">
  201. <view class="info">
  202. <view v-if="userData.shop.isself == 1">
  203. <view class="cu-tag sm line-white radius margin-right-xs">
  204. {{$t('user.self-store')}}
  205. </view>
  206. <text class="text-cut" style="width: 50%;">
  207. {{ userData.shop.shopname }}
  208. </text>
  209. </view>
  210. <view v-else>
  211. <view class="cu-tag sm line-white radius margin-right-xs"
  212. v-if="userData.shop.state == 0">
  213. {{$t('user.personal-store')}}
  214. </view>
  215. <view class="cu-tag sm line-white radius margin-right-xs"
  216. v-if="userData.shop.state == 1">
  217. {{$t('user.enterprise-store')}}
  218. </view>
  219. <view class="cu-tag sm line-white radius margin-right-xs"
  220. v-if="userData.shop.state == 2">
  221. {{$t('user.flagship-store')}}
  222. </view>
  223. <text class="text-cut" style="width: 50%;">
  224. {{ userData.shop.shopname }}
  225. </text>
  226. </view>
  227. </view>
  228. <view class="menu">
  229. <button class="cu-btn wlIcon margin-right-sm line-white round">
  230. <text class="wlIcon-31dianpu"></text>
  231. </button>
  232. </view>
  233. </view>
  234. </view>
  235. </view>
  236. </view>
  237. <view class="wanlgroups-user-container__list bg-white">
  238. <view class="questionbag">
  239. <scroll-view scroll-x class="nav">
  240. <view class=" flex align-center justify-around">
  241. <view class="item " :class="getNavItemIndex(item) === currentId ? 'active' : ''"
  242. v-for="(item, index) in filteredNavList" :key="index" @tap="handleSelectByType(item.type)">
  243. {{ item.type_text }}
  244. </view>
  245. </view>
  246. </scroll-view>
  247. </view>
  248. <view class="main">
  249. <!-- 未登录提示 -->
  250. <view v-if="!$store.state.user.isLogin" class="empty empty--guest">
  251. <view class="text-center wanl-gray">
  252. <image :src="$appKit.appstc('/default/collect_default3x.png')"></image>
  253. <view class="text-30 margin-bottom-bj">
  254. {{ $t('user.welcomeLogin') }}
  255. </view>
  256. <button class="cu-btn line-black" @tap="$appKit.to('/pages/user/auth/newpreLogin')">
  257. {{ $t('user.loginRegister') }}
  258. </button>
  259. </view>
  260. </view>
  261. <!-- 已登录内容 -->
  262. <view v-else v-show="keys === currentId" v-for="(data, keys) in navList" :key="keys">
  263. <block v-if="isMyfind">
  264. <view v-if="data.dataList.length === 0 && data.loaded" class="empty">
  265. <view class="text-center wanl-gray">
  266. <image :src="$appKit.appstc('/default/collect_default3x.png')"></image>
  267. <view class="text-30 margin-bottom-bj">
  268. {{ data.type === 'Comp' ? $t('find.no-compilation') : (keys === 0 ? $t('user.no-works') : $t('user.no-likes')) }}
  269. </view>
  270. <button v-if="data.type === 'Comp'" class="cu-btn line-black" @tap="$appKit.to('/pages/apps/find/user/add_compilation')">
  271. {{$t('find.go-create-compilation')}}
  272. </button>
  273. <button v-else-if="keys === 0" class="cu-btn line-black" @tap="handlePublish()">
  274. {{$t('send_work')}}
  275. </button>
  276. <button v-else class="cu-btn line-black" @click="$appKit.to('/pages/apps/find/list')">
  277. {{$t('user.go-see')}}
  278. </button>
  279. </view>
  280. </view>
  281. </block>
  282. <block v-else>
  283. <empty v-if="data.dataList.length === 0 && data.loaded"
  284. :text="keys === 0 ? $t('user.other-no-works') : $t('user.other-no-likes')"
  285. src="collect_default3x" />
  286. </block>
  287. <!-- Comp 合辑列表 -->
  288. <view class="list" v-if="data.type === 'Comp' && data.dataList.length > 0">
  289. <view class="item" v-for="(item, index) in data.dataList" :key="index">
  290. <view class="examine radius-bock" :style="{
  291. backgroundImage: 'url(' + $appKit.oss(item.image || item.cover || '', 200, 0) + ')'
  292. }" @tap="handleOpenCompilation(item)">
  293. <view class="cover radius-bock" :style="{
  294. backgroundImage: 'url(' + $appKit.oss(item.image || item.cover || '', 200, 0) + ')'
  295. }" />
  296. </view>
  297. <view class="padding-xs text-bold5">
  298. <view class="text-cut-2">
  299. <view class="cu-tag sm radius margin-right-xs wanl-bg-pink">Comp</view>
  300. {{ item.title || '' }}
  301. </view>
  302. </view>
  303. <!-- Comp 操作:编辑 / 删除(仅本人) -->
  304. <view v-if="isMyfind" class="flex wanl-gray text-min padding-lr-xs justify-between">
  305. <view>
  306. <text class="text-red margin-left-xs" @tap="handleCompEdit(item)">{{$t('find.edit-compilation')}}</text>
  307. <text class="text-red margin-left-xs" @tap="handleCompDel(index)">{{$t('find.delete-compilation')}}</text>
  308. </view>
  309. </view>
  310. </view>
  311. </view>
  312. <!-- 默认作品/喜欢列表 -->
  313. <view class="list" v-else-if="$store.state.user.isLogin && data.dataList.length > 0">
  314. <view class="item" v-for="(item, index) in data.dataList" :key="index">
  315. <view v-if="item.state === 'normal'" class="examine radius-bock" :style="{
  316. backgroundImage:
  317. 'url(' + $appKit.oss(item.images[0], 200, 0) + ')'
  318. }" @tap="onFind(item)">
  319. <view class="cover radius-bock" :style="{
  320. backgroundImage:
  321. 'url(' + $appKit.oss(item.images[0], 200, 0) + ')'
  322. }" />
  323. <view v-if="item.type === 'video'" class="state padding-sm text-white text-xxxl">
  324. <text class="wlIcon-video" />
  325. </view>
  326. </view>
  327. <view v-else class="examine radius-bock"
  328. @tap="$appKit.msg(`${stateText[item.state].text}`)">
  329. <view class="cover" :style="{
  330. backgroundImage:
  331. 'url(' + $appKit.oss(item.images[0], 200, 0) + ')'
  332. }" />
  333. <view class="state flex justify-center align-center">
  334. <view v-if="item.state" class="text-xxl text-center"
  335. :style="{ color: stateText[item.state].color }">
  336. <text :class="stateText[item.state].icon" />
  337. <view class="text-df">
  338. {{ stateText[item.state].text }}
  339. </view>
  340. </view>
  341. </view>
  342. </view>
  343. <view class="padding-xs text-bold5">
  344. <view class="text-cut-2">
  345. <view class="cu-tag sm radius margin-right-xs" :class="[typeList[item.type]]">
  346. {{ item.type_text }}
  347. </view>
  348. {{ formatHtml(item.content) }}
  349. </view>
  350. </view>
  351. <view class="flex wanl-gray text-min padding-lr-xs justify-between">
  352. <view>
  353. <text>
  354. {{ $appKit.timeFormat(item.createtime, 'mm-dd') }} {{$t('user.published')}}
  355. </text>
  356. <text v-if="isMyfind && keys === 0" class="text-red margin-left-xs"
  357. @tap="handleDel(index)">
  358. {{$t('user.delete')}}
  359. </text>
  360. </view>
  361. <view :class="{ 'text-red': item.isLike === 1 }" @tap="handleLike(index)">
  362. <text :class="[
  363. item.isLike === 1 ? 'wlIcon-yiguanzhu1' : 'wlIcon-likes'
  364. ]"></text>
  365. <text class="margin-left-xs">{{ item.likes }}</text>
  366. </view>
  367. </view>
  368. </view>
  369. </view>
  370. <uni-load-more v-if="$store.state.user.isLogin" :status="data.loadingType"
  371. :content-text="contentText" />
  372. </view>
  373. </view>
  374. </view>
  375. <!-- Comp 悬浮创建按钮(右下角) -->
  376. <view
  377. v-if="navList[currentId] && navList[currentId].type === 'Comp' && isMyfind"
  378. class="comp-fab"
  379. @tap="$appKit.to('/pages/apps/find/user/add_compilation')"
  380. >
  381. <text class="comp-fab-text">+</text>
  382. </view>
  383. <!-- 模态框 -->
  384. <view class="WANL-MODAL wanlgroups-user-container__modal">
  385. <view class="cu-modal top-modal" :class="modalName == 'menu' ? 'show' : ''" @tap="hideModal()">
  386. <view class="wanl-modal-menu cu-dialog" @tap.stop="">
  387. <direct @change="hideModal" />
  388. </view>
  389. </view>
  390. <!-- 分享 -->
  391. <!-- <view class="cu-modal wanl-share bottom-modal" :class="modalName == 'share' ? 'show' : ''"
  392. @tap="hideModal()">
  393. <view class="cu-dialog" @tap.stop="">
  394. <share
  395. ref="wanlShare"
  396. page="pages/apps/find/user"
  397. :scene="{id:find_user, qr:'fu'}"
  398. :scrollAnimation="scrollAnimation"
  399. @change="hideModal()"
  400. />
  401. </view>
  402. </view> -->
  403. <view class="cu-modal praised" :class="modalName == 'praised' ? 'show' : ''" @tap="hideModal()">
  404. <view class="cu-dialog" @tap.stop="">
  405. <image :src="$appKit.appstc('/common/find_fans3x.png')" mode="widthFix"></image>
  406. <view class="margin-tb-lg">
  407. <text class="wanl-gray-dark">
  408. {{
  409. `“${userData.user.nickname}”共收獲得 ${$appKit.toFormat(
  410. userData.praised < 0 ? 0 : userData.praised,
  411. 'thousand'
  412. )} 個讚`
  413. }}
  414. </text>
  415. </view>
  416. <view class="padding-tb-bj solid-top" @tap="hideModal()">
  417. <text class="text-bold">{{$t('user.confirm')}}</text>
  418. </view>
  419. </view>
  420. </view>
  421. </view>
  422. <view class="myuser-tabbar-pad" />
  423. <app-tabbar active="mine" />
  424. </view>
  425. </template>
  426. <script>
  427. import {
  428. mapState
  429. } from 'vuex';
  430. import AppTabbar from '@/components/app-tabbar/app-tabbar.vue'
  431. export default {
  432. components: { AppTabbar },
  433. data() {
  434. return {
  435. pagebgImage: '/static/imgs/topbg1.png',
  436. find_user: null,
  437. fromUserPage: false, // 是否从 user.vue 跳转过来(用于显示返回按钮)
  438. headHeight: 0,
  439. headerOpacity: 0,
  440. windowHeight: 0,
  441. headTop: 0,
  442. isMyfind: false,
  443. loadingFollow: false,
  444. modalName: null,
  445. scrollAnimation: 300,
  446. diamondBalance: null, // 钻石余额
  447. tipWallet: null, // 赏金余额
  448. userData: {
  449. user_no: '',
  450. user: {
  451. avatar: '',
  452. nickname: this.$t('user.loading')
  453. },
  454. follow: 0,
  455. fans: 0,
  456. likes: 0,
  457. praised: 0,
  458. color: '#F9EEC4',
  459. image: '',
  460. isFollow: 0
  461. },
  462. stateText: {
  463. publish: {
  464. icon: 'wlIcon-jiazai wlIconfont-spin',
  465. text: this.$t('send_work'),
  466. color: '#fff'
  467. },
  468. examine: {
  469. icon: 'wlIcon-shouhoufuwu-zidongpingjia',
  470. text: this.$t('user.under-review'),
  471. color: '#e6442b'
  472. },
  473. hazard: {
  474. icon: 'wlIcon-zhuyidapx',
  475. text: this.$t('user.content-violation'),
  476. color: '#e6442b'
  477. },
  478. transcoding: {
  479. icon: 'wlIcon-jiazai1 wlIconfont-spin',
  480. text: this.$t('user.transcoding'),
  481. color: '#fff'
  482. },
  483. screenshot: {
  484. icon: 'wlIcon-tupian wlIconfont-spin',
  485. text: this.$t('user.generating-cover'),
  486. color: '#fff'
  487. }
  488. },
  489. currentId: 0,
  490. typeList: {
  491. new: 'bg-gradual-yellow',
  492. live: 'wanl-bg-orange',
  493. want: 'bg-gradual-green',
  494. activity: 'bg-gradual-orange',
  495. show: 'wanl-bg-pink',
  496. video: 'wanl-bg-pink'
  497. },
  498. navList: [{
  499. type: 'works',
  500. type_text: this.$t('work'),
  501. dataList: [],
  502. loadingType: 'more',
  503. current_page: 1
  504. },
  505. {
  506. type: 'likes',
  507. type_text: this.$t('my_like'),
  508. dataList: [],
  509. loadingType: 'more',
  510. current_page: 1
  511. },
  512. {
  513. type: 'Comp',
  514. type_text: this.$t('find.compilation'),
  515. dataList: [],
  516. loadingType: 'more',
  517. current_page: 1
  518. }
  519. ],
  520. contentText: {
  521. contentdown: ' ',
  522. contentrefresh: this.$t('user.loading'),
  523. contentnomore: this.$t('user.no-more-data')
  524. },
  525. isRefreshing: false
  526. };
  527. },
  528. computed: {
  529. ...mapState(['common', 'user']),
  530. // 过滤后的导航列表(非作者不显示 Comp tab)
  531. filteredNavList() {
  532. if (this.isMyfind) {
  533. return this.navList;
  534. }
  535. return this.navList.filter(item => item.type !== 'Comp');
  536. }
  537. },
  538. watch: {
  539. // 监听用户登录状态变化,退出登录时清除用户信息
  540. '$store.state.user': {
  541. handler(newUser) {
  542. // 当用户退出登录时,重置用户数据
  543. if (!newUser.isLogin) {
  544. this.userData = {
  545. user_no: '',
  546. user: {
  547. avatar: '',
  548. nickname: this.$t('user.loginRegister')
  549. },
  550. follow: 0,
  551. fans: 0,
  552. likes: 0,
  553. praised: 0,
  554. color: '#F9EEC4',
  555. image: '',
  556. isFollow: 0
  557. };
  558. this.isMyfind = false;
  559. // 清空列表数据
  560. this.navList.forEach(item => {
  561. item.dataList = [];
  562. item.current_page = 1;
  563. item.loadingType = 'more';
  564. item.loaded = false;
  565. });
  566. } else {
  567. // 用户登录后,如果有用户ID,重新加载数据
  568. if (this.find_user) {
  569. this.loadData();
  570. }
  571. }
  572. },
  573. deep: true
  574. }
  575. },
  576. onLoad(query) {
  577. // 计算页面尺寸
  578. let sys = this.$appKit.wanlsys();
  579. this.headTop = sys.top;
  580. this.headHeight = sys.height;
  581. this.windowHeight = sys.windowHeight;
  582. // 是否从个人中心 user.vue 进入(显示返回按钮)
  583. this.fromUserPage = query.from === 'user';
  584. // 判断是否小程序来源 1.1.9升级
  585. if (query.hasOwnProperty('scene')) {
  586. let scene = decodeURIComponent(query.scene);
  587. scene = this.$appKit.getParam(scene);
  588. this.find_user = scene.id;
  589. } else {
  590. if (query.hasOwnProperty('id')) {
  591. this.find_user = query.id;
  592. }
  593. }
  594. // 加载 Api(如果已登录或传入了用户ID)
  595. if (this.$store.state.user.isLogin || this.find_user) {
  596. this.refreshPageData({
  597. silent: true,
  598. source: 'silentRefresh'
  599. });
  600. }
  601. },
  602. onShow() {
  603. setTimeout(() => {
  604. try { uni.hideTabBar({ animation: false }) } catch (_) {}
  605. }, 0)
  606. // 检查是否需要刷新 Comp 列表(从 add_compilation.vue 返回)
  607. const shouldRefresh = uni.getStorageSync('user_compilation_should_refresh');
  608. if (shouldRefresh) {
  609. // 清除标志
  610. uni.removeStorageSync('user_compilation_should_refresh');
  611. // 如果当前在 Comp tab,刷新列表
  612. const navItem = this.navList[this.currentId];
  613. if (navItem && navItem.type === 'Comp') {
  614. // 重置列表数据
  615. navItem.dataList = [];
  616. navItem.current_page = 1;
  617. navItem.loadingType = 'more';
  618. navItem.loaded = false;
  619. navItem._lastLoadedPage = undefined;
  620. // 重新加载
  621. this.loadCompilationList('refresh');
  622. }
  623. }
  624. // 如果是本人,刷新钻石余额和赏金余额
  625. if (this.$store.state.user.isLogin && this.isMyfind) {
  626. this.loadDiamondBalance();
  627. this.loadTipWallet();
  628. }
  629. // 进入页面时静默刷新当前展示内容
  630. if (this.$store.state.user.isLogin || this.find_user) {
  631. this.refreshPageData({
  632. silent: true,
  633. source: 'silentRefresh'
  634. });
  635. }
  636. },
  637. // 下拉刷新
  638. onPullDownRefresh() {
  639. this.refreshPageData({
  640. silent: false,
  641. source: 'refresh'
  642. });
  643. },
  644. // 下拉刷新
  645. onReachBottom() {
  646. this.loadFindData();
  647. },
  648. onPageScroll(e) {
  649. let tmpY = 170;
  650. e.scrollTop = e.scrollTop > tmpY ? 170 : e.scrollTop;
  651. this.headerOpacity = e.scrollTop * (1 / tmpY);
  652. },
  653. methods: {
  654. async refreshPageData({
  655. silent = true,
  656. source = 'refresh'
  657. } = {}) {
  658. if (this.isRefreshing) {
  659. uni.stopPullDownRefresh();
  660. return;
  661. }
  662. this.isRefreshing = true;
  663. try {
  664. await this.loadData({
  665. silent,
  666. source
  667. });
  668. } finally {
  669. this.isRefreshing = false;
  670. uni.stopPullDownRefresh();
  671. }
  672. },
  673. async loadData({
  674. silent = false,
  675. source = 'append'
  676. } = {}) {
  677. // 首先检查用户是否已登录,未登录时不加载数据
  678. if (!this.$store.state.user.isLogin) {
  679. // 如果未登录且没有传入用户ID,显示默认信息
  680. if (!this.find_user) {
  681. this.userData = {
  682. user_no: '',
  683. user: {
  684. avatar: '',
  685. nickname: this.$t('user.loginRegister')
  686. },
  687. follow: 0,
  688. fans: 0,
  689. likes: 0,
  690. praised: 0,
  691. color: '#F9EEC4',
  692. image: '',
  693. isFollow: 0
  694. };
  695. this.refreshThemeBackground();
  696. this.isMyfind = false;
  697. }
  698. return;
  699. }
  700. await uni.request({
  701. url: '/wanlshop/find/user/userInfo',
  702. method: 'POST',
  703. data: {
  704. id: this.find_user
  705. },
  706. success: res => {
  707. if (res.data.user_id === this.$store.state.user.id) {
  708. this.isMyfind = true;
  709. // 如果是本人,加载钻石余额和赏金余额
  710. this.loadDiamondBalance();
  711. this.loadTipWallet();
  712. } else {
  713. // 如果不是作者,且当前选中的是 Comp tab(索引为 2),则切换到第一个 tab
  714. if (this.currentId === 2) {
  715. this.currentId = 0;
  716. }
  717. }
  718. // this.navList[0].type_text = `作品(${res.data.works})`;
  719. // this.navList[1].type_text = `喜欢(${res.data.likes})`;
  720. this.userData = res.data;
  721. this.refreshThemeBackground();
  722. this.loadFindData(source);
  723. }
  724. });
  725. },
  726. loadFindData(source) {
  727. //这里是将订单挂载到tab列表下
  728. let navItem = this.navList[this.currentId];
  729. // Comp 合辑:走独立接口
  730. if (navItem.type === 'Comp') {
  731. this.loadCompilationList(source);
  732. return;
  733. }
  734. const isRefreshRequest = source === 'refresh' || source === 'silentRefresh';
  735. if (isRefreshRequest) {
  736. // 刷新当前 tab:回到第一页;手动下拉时先清空,静默刷新保持旧列表避免闪烁。
  737. navItem.current_page = 1;
  738. navItem.loadingType = 'more';
  739. navItem.loaded = false;
  740. navItem._lastLoadedPage = undefined;
  741. if (source === 'refresh') {
  742. navItem.dataList = [];
  743. }
  744. }
  745. //判断是否最后一页
  746. if (navItem.loadingType == 'noMore') {
  747. console.log("请求作品列表:1")
  748. return;
  749. }
  750. //tab切换只有第一次需要加载数据
  751. if (source === 'tabChange' && navItem.loaded === true) {
  752. console.log("请求作品列表:2")
  753. return;
  754. }
  755. //防止重复加载
  756. if (navItem.loadingType === 'loading') {
  757. console.log("请求作品列表:3")
  758. return;
  759. }
  760. navItem.loadingType = 'loading';
  761. let type =
  762. navItem.type === 'works' ? (this.isMyfind ? 'myfind' : navItem.type) : navItem.type;
  763. // 获取列表
  764. uni.request({
  765. url: '/wanlshop/find/find/getList',
  766. data: {
  767. type: type,
  768. user_no: this.userData.user_no,
  769. page: navItem.current_page
  770. },
  771. success: res => {
  772. console.log("请求作品列表成功:" + res.data)
  773. navItem.current_page = res.data.current_page; //当前页码
  774. if (res.data.last_page === res.data.current_page) {
  775. navItem.loadingType = 'noMore';
  776. } else {
  777. navItem.loadingType = 'more';
  778. navItem.current_page++;
  779. }
  780. const incoming = Array.isArray(res.data.data) ? res.data.data : [];
  781. if (isRefreshRequest) {
  782. navItem.dataList = incoming;
  783. } else {
  784. incoming.forEach(item => {
  785. navItem.dataList.push(item);
  786. });
  787. }
  788. this.$set(navItem, 'loaded', true);
  789. },
  790. fail() {
  791. navItem.loadingType = 'more';
  792. }
  793. });
  794. },
  795. // 加载合辑列表
  796. loadCompilationList(source) {
  797. let navItem = this.navList[this.currentId];
  798. // 刷新模式:重置数据并重新加载第一页
  799. if (source === 'refresh') {
  800. navItem.dataList = [];
  801. navItem.current_page = 1;
  802. navItem.loadingType = 'more';
  803. navItem.loaded = false;
  804. navItem._lastLoadedPage = undefined;
  805. }
  806. // tab切换只有第一次需要加载数据
  807. if (source === 'tabChange' && navItem.loaded === true) {
  808. return;
  809. }
  810. // 防止重复加载
  811. if (navItem.loadingType === 'loading') {
  812. return;
  813. }
  814. navItem.loadingType = 'loading';
  815. uni.request({
  816. url: '/wanlshop/videoseries/list',
  817. method: 'GET',
  818. data: {
  819. user_no: this.userData.user_no,
  820. page: navItem.current_page
  821. },
  822. success: res => {
  823. // 兼容返回结构:code 包装 / 直接数组 / 分页结构
  824. const body = res.data;
  825. const payload = (body && body.code !== undefined) ? body.data : body;
  826. // 提取列表
  827. const list = Array.isArray(payload)
  828. ? payload
  829. : (payload && payload.data ? payload.data : []);
  830. // 提取分页信息(优先 payload,其次 body 顶层兜底)
  831. const currentPage =
  832. (payload && payload.current_page) ? payload.current_page :
  833. (body && body.current_page) ? body.current_page :
  834. navItem.current_page;
  835. const lastPage =
  836. (payload && payload.last_page) ? payload.last_page :
  837. (body && body.last_page) ? body.last_page :
  838. currentPage;
  839. // 刷新模式:直接替换列表数据
  840. if (source === 'refresh') {
  841. navItem.dataList = list || [];
  842. navItem._lastLoadedPage = Number(currentPage);
  843. } else {
  844. // 防重复:如果后端不生效 page,可能一直返回同一页,避免重复 append
  845. if (navItem._lastLoadedPage !== undefined && Number(currentPage) <= Number(navItem._lastLoadedPage)) {
  846. navItem.loadingType = 'noMore';
  847. this.$set(navItem, 'loaded', true);
  848. return;
  849. }
  850. navItem._lastLoadedPage = Number(currentPage);
  851. // 去重:按 id 过滤,避免重复页导致数据越来越多
  852. const exists = new Set((navItem.dataList || []).map(x => x && x.id).filter(Boolean));
  853. list.forEach(item => {
  854. if (!item) return;
  855. if (item.id && exists.has(item.id)) return;
  856. if (item.id) exists.add(item.id);
  857. navItem.dataList.push(item);
  858. });
  859. }
  860. // 空列表直接 noMore
  861. if (!list || list.length === 0) {
  862. navItem.loadingType = 'noMore';
  863. this.$set(navItem, 'loaded', true);
  864. return;
  865. }
  866. // 更新下一页
  867. if (Number(currentPage) >= Number(lastPage)) {
  868. navItem.loadingType = 'noMore';
  869. } else {
  870. navItem.loadingType = 'more';
  871. navItem.current_page = Number(currentPage) + 1;
  872. }
  873. this.$set(navItem, 'loaded', true);
  874. },
  875. fail: () => {
  876. navItem.loadingType = 'more';
  877. this.$set(navItem, 'loaded', true);
  878. }
  879. });
  880. },
  881. // Comp:打开合辑视频列表
  882. handleOpenCompilation(item) {
  883. if (!item) return;
  884. const seriesId = item.id || item.series_id || item.seriesId;
  885. if (!seriesId) {
  886. this.$appKit.msg(this.$t('find.missing-compilation-id-cannot-open'));
  887. return;
  888. }
  889. // 进入合辑视频列表页
  890. this.$appKit.to(`/pages/apps/find/details/compilationlist?series_id=${encodeURIComponent(String(seriesId))}&id=${encodeURIComponent(String(seriesId))}`);
  891. },
  892. // Comp:编辑合辑
  893. handleCompEdit(item) {
  894. if (!item) return;
  895. const id = item.id || item.series_id || item.seriesId || '';
  896. const title = encodeURIComponent(item.title || '');
  897. const image = encodeURIComponent(item.image || item.cover || '');
  898. // 进入编辑模式:传入 id/title/image
  899. this.$appKit.to(`/pages/apps/find/user/add_compilation?id=${id}&title=${title}&image=${image}&edit=1`);
  900. },
  901. // Comp:删除合辑
  902. handleCompDel(index) {
  903. const navItem = this.navList[this.currentId];
  904. const item = navItem && navItem.dataList ? navItem.dataList[index] : null;
  905. if (!item) return;
  906. const id = item.id || item.series_id || item.seriesId;
  907. if (!id) {
  908. this.$appKit.msg(this.$t('find.missing-compilation-id-cannot-delete'));
  909. return;
  910. }
  911. uni.showModal({
  912. content: this.$t('find.confirm-delete-compilation'),
  913. success: (res) => {
  914. if (!res.confirm) return;
  915. uni.request({
  916. url: '/wanlshop/videoseries/del',
  917. method: 'POST',
  918. data: { id },
  919. success: (r) => {
  920. const body = (r && r.data !== undefined) ? r.data : r;
  921. if (r.res.code === 1) {
  922. navItem.dataList.splice(index, 1);
  923. this.$appKit.msg(body.msg || this.$t('find.delete-compilation-success'));
  924. } else {
  925. this.$appKit.msg((body && body.msg) ? body.msg : this.$t('find.delete-compilation-failed'));
  926. }
  927. },
  928. fail: () => {
  929. this.$appKit.msg(this.$t('find.delete-compilation-failed'));
  930. }
  931. });
  932. }
  933. });
  934. },
  935. async handleFollow(shop) {
  936. if (this.$store.state.user.isLogin) {
  937. this.loadingFollow = true;
  938. await uni.request({
  939. url: '/wanlshop/find/user/setFindUser',
  940. method: 'POST',
  941. data: {
  942. id: this.userData.user_no,
  943. type: 'follow'
  944. },
  945. success: res => {
  946. if (shop) {
  947. let concern = this.$store.state.statistics.dynamic.concern;
  948. if (res.data.data === 0) {
  949. concern -= 1;
  950. } else {
  951. concern += 1;
  952. }
  953. this.$store.commit('statistics/dynamic', {
  954. concern: concern
  955. });
  956. }
  957. if (res.data.data === 1) {
  958. this.userData.fans += 1;
  959. } else if (res.data.data === 0) {
  960. this.userData.fans -= 1;
  961. }
  962. this.userData.isFollow = res.data.data;
  963. this.loadingFollow = false;
  964. }
  965. });
  966. } else {
  967. this.$appKit.to('/pages/user/auth/newpreLogin');
  968. }
  969. },
  970. async handleLike(index) {
  971. if (this.$store.state.user.isLogin) {
  972. let data = this.navList[this.currentId].dataList[index];
  973. await uni.request({
  974. url: '/wanlshop/find/user/setFindUser',
  975. method: 'POST',
  976. data: {
  977. id: data.id,
  978. type: 'likes'
  979. },
  980. success: res => {
  981. if (res.data.data === 0) {
  982. data.likes -= 1;
  983. } else {
  984. data.likes += 1;
  985. }
  986. data.isLike = res.data.data;
  987. }
  988. });
  989. } else {
  990. this.$appKit.to('/pages/user/auth/newpreLogin');
  991. }
  992. },
  993. async handleDel(index) {
  994. if (this.$store.state.user.isLogin) {
  995. uni.showModal({
  996. content: this.$t('user.delete-confirm'),
  997. success: res => {
  998. if (res.confirm) {
  999. let data = this.navList[this.currentId].dataList;
  1000. uni.request({
  1001. url: '/wanlshop/find/find/delData',
  1002. method: 'POST',
  1003. data: {
  1004. id: data[index].id
  1005. },
  1006. success: del => {
  1007. data.splice(index, 1);
  1008. }
  1009. });
  1010. }
  1011. }
  1012. });
  1013. } else {
  1014. this.$appKit.to('/pages/user/auth/newpreLogin');
  1015. }
  1016. },
  1017. async handleTheme() {
  1018. if (this.isMyfind) {
  1019. uni.showActionSheet({
  1020. itemList: [this.$t('user.select-theme'), this.$t('user.upload-image')],
  1021. success: action => {
  1022. if (action.tapIndex === 0) {
  1023. this.$appKit.to('/pages/user/theme');
  1024. } else if (action.tapIndex === 1) {
  1025. uni.chooseImage({
  1026. success: res => {
  1027. uni.request({
  1028. url: '/wanlshop/common/uploadData',
  1029. success: updata => {
  1030. uni.uploadFile({
  1031. url: updata.data
  1032. .uploadurl,
  1033. filePath: res
  1034. .tempFilePaths[0],
  1035. name: 'file',
  1036. formData: updata.data
  1037. .storage ==
  1038. 'local' ? null :
  1039. updata.data
  1040. .multipart,
  1041. success: data => {
  1042. this.editTheme({
  1043. url: JSON
  1044. .parse(
  1045. data
  1046. .data
  1047. )
  1048. .data
  1049. .url,
  1050. type: 'upload'
  1051. });
  1052. },
  1053. fail: error => {
  1054. uni.showToast({
  1055. title: JSON
  1056. .parse(
  1057. error
  1058. .data
  1059. )
  1060. .msg,
  1061. icon: 'error',
  1062. position: true
  1063. });
  1064. }
  1065. });
  1066. }
  1067. });
  1068. }
  1069. });
  1070. }
  1071. }
  1072. });
  1073. }
  1074. },
  1075. async editTheme(data) {
  1076. await uni.request({
  1077. url: '/wanlshop/find/user/editTheme',
  1078. method: 'POST',
  1079. data: data,
  1080. success: res => {
  1081. this.userData.image = res.data.image;
  1082. this.userData.color = res.data.color;
  1083. this.refreshThemeBackground();
  1084. }
  1085. });
  1086. },
  1087. refreshThemeBackground() {
  1088. if (this.userData && this.userData.image) {
  1089. // 与 user.vue 保持一致,主题图使用 oss 处理后的地址
  1090. this.pagebgImage = this.$appKit.oss(this.userData.image, 0, 50, 1, 'transparent', 'png');
  1091. } else {
  1092. this.pagebgImage = '/static/imgs/topbg1.png';
  1093. }
  1094. },
  1095. handlePublish() {
  1096. let itemList = [],
  1097. url = [];
  1098. if (this.userData.shop) {
  1099. if (this.userData.isVideo) {
  1100. if (this.userData.isLive) {
  1101. itemList = [this.$t('user.publish-grass'), this.$t('user.publish-video'), this.$t(
  1102. 'user.merchant-live')];
  1103. url = ['/pages/apps/find/user/add?type=want', '/pages/apps/find/user/add?type=video',
  1104. '/pages/shop/live/live'
  1105. ];
  1106. } else {
  1107. itemList = [this.$t('user.publish-grass'), this.$t('user.publish-video')];
  1108. url = ['/pages/apps/find/user/add?type=want', '/pages/apps/find/user/add?type=video'];
  1109. }
  1110. } else {
  1111. if (this.userData.isLive) {
  1112. itemList = [this.$t('user.publish-grass'), this.$t('user.merchant-live')];
  1113. url = ['/pages/apps/find/user/add?type=want', '/pages/apps/find/user/add?type=video'];
  1114. } else {
  1115. itemList = [this.$t('user.publish-grass')];
  1116. url = ['/pages/apps/find/user/add?type=want'];
  1117. }
  1118. }
  1119. } else {
  1120. if (this.userData.isVideo) {
  1121. itemList = [this.$t('user.publish-grass'), this.$t('user.publish-video')];
  1122. url = ['/pages/apps/find/user/add?type=want', '/pages/apps/find/user/add?type=video'];
  1123. } else {
  1124. itemList = [this.$t('user.publish-grass')];
  1125. url = ['/pages/apps/find/user/add?type=want'];
  1126. }
  1127. }
  1128. uni.showActionSheet({
  1129. itemList: itemList,
  1130. success: res => {
  1131. if (res.tapIndex === 2) {
  1132. // #ifdef APP-PLUS || MP-WEIXIN
  1133. this.$appKit.to(url[res.tapIndex]);
  1134. // #endif
  1135. // #ifndef APP-PLUS || MP-WEIXIN
  1136. this.$appKit.msg(this.$t('user.app-wechat-only'));
  1137. // #endif
  1138. } else {
  1139. this.$appKit.to(url[res.tapIndex]);
  1140. }
  1141. }
  1142. });
  1143. },
  1144. // 选择Tag(通过索引)
  1145. handleSelect(index) {
  1146. this.currentId = index;
  1147. this.loadFindData('tabChange');
  1148. },
  1149. // 选择Tag(通过类型,用于过滤后的列表)
  1150. handleSelectByType(type) {
  1151. const index = this.navList.findIndex(item => item.type === type);
  1152. if (index !== -1) {
  1153. this.currentId = index;
  1154. this.loadFindData('tabChange');
  1155. }
  1156. },
  1157. // 获取导航项在原始列表中的索引(用于高亮显示)
  1158. getNavItemIndex(item) {
  1159. return this.navList.findIndex(nav => nav.type === item.type);
  1160. },
  1161. handleBack() {
  1162. this.$appKit.back(1);
  1163. },
  1164. handleUserEdit() {
  1165. this.$appKit.auth('/pages/user/setting/user');
  1166. },
  1167. // 开启直播
  1168. handleStartLive() {
  1169. // 检查是否是当前用户的页面
  1170. if (this.isMyfind) {
  1171. // #ifdef APP-PLUS || MP-WEIXIN
  1172. this.$appKit.to('/pages/shop/live/live');
  1173. // #endif
  1174. // #ifndef APP-PLUS || MP-WEIXIN
  1175. this.$appKit.msg(this.$t('user.app-wechat-only'));
  1176. // #endif
  1177. } else {
  1178. this.$appKit.msg(this.$t('user.only-self-live'));
  1179. }
  1180. },
  1181. // 格式化html
  1182. formatHtml(content) {
  1183. return content.replace(/<\/?.+?>/g, '').replace(/ /g, '');
  1184. },
  1185. // 弹出层
  1186. showModal(name) {
  1187. // 滚动下分享
  1188. if (name == 'share' && this.modalName != 'share') {
  1189. setTimeout(() => {
  1190. this.scrollAnimation = 300;
  1191. }, 300);
  1192. }
  1193. this.modalName = name;
  1194. },
  1195. hideModal(name) {
  1196. if (name) {
  1197. this.showModal(name);
  1198. } else {
  1199. // 强制关闭海报
  1200. if (this.modalName == 'share') {
  1201. // this.$refs.wanlShare.closePoster();
  1202. }
  1203. this.modalName = null;
  1204. }
  1205. },
  1206. // 加载钻石余额
  1207. async loadDiamondBalance() {
  1208. try {
  1209. const [err, res] = await uni.request({
  1210. url: '/user/getdiamondnum'
  1211. });
  1212. if (err) {
  1213. console.error('Load diamond balance error:', err);
  1214. this.diamondBalance = 0;
  1215. return;
  1216. }
  1217. // 兼容不同的返回格式
  1218. if (typeof res.data === 'string') {
  1219. this.diamondBalance = Number(res.data) || 0;
  1220. } else if (res.data != null && typeof res.data === 'object') {
  1221. if (res.data.diamond != null) {
  1222. this.diamondBalance = Number(res.data.diamond) || 0;
  1223. } else if (res.data.data != null && typeof res.data.data === 'object' && res.data.data.diamond != null) {
  1224. this.diamondBalance = Number(res.data.data.diamond) || 0;
  1225. } else {
  1226. const body = res && res.data ? res.data : res;
  1227. if (body && typeof body === 'object') {
  1228. if (body.code !== undefined && Number(body.code) === 1) {
  1229. if (typeof body.data === 'string') {
  1230. this.diamondBalance = Number(body.data) || 0;
  1231. } else if (body.data && typeof body.data === 'object' && body.data.diamond != null) {
  1232. this.diamondBalance = Number(body.data.diamond) || 0;
  1233. }
  1234. } else if (body.diamond != null) {
  1235. this.diamondBalance = Number(body.diamond) || 0;
  1236. }
  1237. }
  1238. }
  1239. }
  1240. } catch (error) {
  1241. console.error('Load diamond balance error:', error);
  1242. this.diamondBalance = 0;
  1243. }
  1244. },
  1245. // 加载赏金余额
  1246. async loadTipWallet() {
  1247. try {
  1248. const [err, res] = await uni.request({
  1249. url: '/user/gettipwallet'
  1250. });
  1251. if (err) {
  1252. console.error('Load tip wallet error:', err);
  1253. this.tipWallet = '0.00';
  1254. return;
  1255. }
  1256. // 处理返回格式: {"data": {"tip_wallet": "8440.00"}}
  1257. if (res.data && typeof res.data === 'object') {
  1258. if (res.data.data && res.data.data.tip_wallet != null) {
  1259. this.tipWallet = res.data.data.tip_wallet;
  1260. } else if (res.data.tip_wallet != null) {
  1261. this.tipWallet = res.data.tip_wallet;
  1262. } else {
  1263. this.tipWallet = '0.00';
  1264. }
  1265. } else {
  1266. this.tipWallet = '0.00';
  1267. }
  1268. } catch (error) {
  1269. console.error('Load tip wallet error:', error);
  1270. this.tipWallet = '0.00';
  1271. }
  1272. }
  1273. }
  1274. };
  1275. </script>
  1276. <style lang="scss">
  1277. page {
  1278. background-color: #F9F7FC;
  1279. }
  1280. .pagebg {
  1281. width: 100%;
  1282. position: absolute;
  1283. top: 0;
  1284. left: 0;
  1285. right: 0;
  1286. }
  1287. .wanlgroups-user-container {
  1288. position: relative;
  1289. &__head {
  1290. position: fixed;
  1291. top: 0;
  1292. left: 0;
  1293. right: 0;
  1294. z-index: 9;
  1295. .background {
  1296. position: absolute;
  1297. left: 0;
  1298. right: 0;
  1299. z-index: 1;
  1300. .bgcolor {
  1301. width: 100%;
  1302. height: 100%;
  1303. // background-color: rgba(0, 0, 0, 0.6);
  1304. }
  1305. }
  1306. .navigater {
  1307. display: flex;
  1308. justify-content: space-between;
  1309. align-items: center;
  1310. position: absolute;
  1311. left: 0;
  1312. right: 0;
  1313. z-index: 9;
  1314. padding-left: 25rpx;
  1315. padding-right: 25rpx;
  1316. /* #ifdef MP */
  1317. padding-right: 200rpx;
  1318. /* #endif */
  1319. &>view {
  1320. display: flex;
  1321. align-items: center;
  1322. }
  1323. }
  1324. }
  1325. &__main {
  1326. padding:0 24rpx;
  1327. position: relative;
  1328. background-size: 100% auto;
  1329. background-repeat: no-repeat;
  1330. background-position-y: center;
  1331. .text-white-agba {
  1332. color: rgba(255, 255, 255, 0.9);
  1333. }
  1334. .head {
  1335. .userinfo {
  1336. padding-left: 24rpx;
  1337. padding-right: 20rpx;
  1338. .userinfo-main {
  1339. display: flex;
  1340. align-items: flex-start;
  1341. justify-content: space-between;
  1342. }
  1343. .cu-avatar {
  1344. width: 130rpx;
  1345. height: 130rpx;
  1346. }
  1347. .mz {
  1348. font-weight: 500;
  1349. font-size: 43rpx;
  1350. color: #121836;
  1351. line-height: 62rpx;
  1352. }
  1353. .txt {
  1354. font-weight: 500;
  1355. font-size: 24rpx;
  1356. color: #AAB0BA;
  1357. line-height: 34rpx;
  1358. }
  1359. .qianming {
  1360. font-weight: 400;
  1361. font-size: 24rpx;
  1362. color: #AAB0BA;
  1363. line-height: 34rpx;
  1364. margin-top: 16rpx;
  1365. padding-left: 0;
  1366. }
  1367. }
  1368. .anniu-btn {
  1369. background: none;
  1370. padding: 0 14rpx;
  1371. height: 44rpx;
  1372. font-weight: 500;
  1373. font-size: 24rpx;
  1374. color: #121836;
  1375. line-height: 24rpx;
  1376. border: 1px solid #121836;
  1377. }
  1378. .findinfo {
  1379. padding: 20rpx 24rpx;
  1380. background: #fff;
  1381. border-radius: 20rpx 20rpx 0rpx 0rpx;
  1382. .quantity {
  1383. .project {
  1384. margin-right: 10rpx;
  1385. .num {
  1386. font-weight: 700;
  1387. font-size: 43rpx;
  1388. color: #282C38;
  1389. text {
  1390. font-size: 20rpx;
  1391. }
  1392. }
  1393. .mz {
  1394. font-weight: 500;
  1395. font-size: 24rpx;
  1396. color: #AAB0BA;
  1397. }
  1398. }
  1399. }
  1400. .user-assets {
  1401. margin-top: 20rpx;
  1402. padding-top: 20rpx;
  1403. .project {
  1404. display: flex;
  1405. justify-content: space-around;
  1406. text-align: center;
  1407. >view {
  1408. position: relative;
  1409. flex: 1;
  1410. }
  1411. .wanl-pip {
  1412. font-weight: 600;
  1413. font-size: 36rpx;
  1414. color: #282C38;
  1415. line-height: 50rpx;
  1416. }
  1417. .solid-left {
  1418. border-left: 1rpx solid #F1F1F1;
  1419. padding-left: 20rpx;
  1420. }
  1421. .bill-details-center {
  1422. display: flex;
  1423. flex-direction: column;
  1424. justify-content: center;
  1425. align-items: center;
  1426. text-align: center;
  1427. }
  1428. }
  1429. }
  1430. }
  1431. .shopinfo {
  1432. display: flex;
  1433. align-items: center;
  1434. justify-content: space-between;
  1435. &.solid-top {
  1436. &::after {
  1437. border-top: 1rpx solid rgba(255, 255, 255, 0.92);
  1438. }
  1439. }
  1440. .cu-avatar {
  1441. background-color: rgba(0, 0, 0, 0.1);
  1442. width: 65rpx;
  1443. height: 65rpx;
  1444. }
  1445. .subject {
  1446. flex: 1;
  1447. display: flex;
  1448. align-items: center;
  1449. justify-content: space-between;
  1450. .info {
  1451. &>view {
  1452. display: flex;
  1453. align-items: center;
  1454. }
  1455. }
  1456. }
  1457. }
  1458. }
  1459. }
  1460. &__list {margin:0 24rpx;
  1461. background: #fff;
  1462. position: relative;
  1463. .questionbag {
  1464. position: -webkit-sticky;
  1465. position: sticky;
  1466. z-index: 99;
  1467. padding: 24rpx;
  1468. .nav {
  1469. border-bottom: 1px solid #F1F1F1;
  1470. .item {
  1471. display: inline-block;
  1472. font-weight: 500;
  1473. font-size: 32rpx;
  1474. color: #4D4E50;
  1475. line-height: 60rpx;
  1476. padding: 0 10rpx;
  1477. position: relative;
  1478. border-bottom: 2px solid #fff;
  1479. &.active {
  1480. font-size: 32rpx;
  1481. color: #000000;
  1482. border-bottom: 2px solid #FF000A;
  1483. }
  1484. }
  1485. }
  1486. }
  1487. .main {
  1488. .empty {
  1489. padding-top: 100rpx;
  1490. display: flex;
  1491. justify-content: center;
  1492. image {
  1493. width: 320rpx;
  1494. height: 320rpx;
  1495. }
  1496. /* 未登录:白底区域向下延伸,避免按钮贴底与背景断层 */
  1497. &.empty--guest {
  1498. flex-direction: column;
  1499. align-items: center;
  1500. padding-bottom: 160rpx;
  1501. min-height: 520rpx;
  1502. /* #ifndef APP-NVUE */
  1503. padding-bottom: calc(160rpx + constant(safe-area-inset-bottom));
  1504. padding-bottom: calc(160rpx + env(safe-area-inset-bottom));
  1505. /* #endif */
  1506. }
  1507. }
  1508. .list {
  1509. display: flex;
  1510. flex-direction: row;
  1511. flex-wrap: wrap;
  1512. padding: 0 24rpx;
  1513. justify-content: space-between;
  1514. .item {
  1515. margin-bottom: 40rpx;
  1516. flex: 0 0 calc((100% - 22rpx) / 2);
  1517. overflow: hidden;
  1518. .examine {
  1519. height: 460rpx;
  1520. position: relative;
  1521. .cover {
  1522. height: 460rpx;
  1523. background-size: cover;
  1524. background-position: center;
  1525. background-repeat: no-repeat;
  1526. }
  1527. .state {
  1528. position: absolute;
  1529. top: 0;
  1530. right: 0;
  1531. left: 0;
  1532. bottom: 0;
  1533. background-color: rgba(0, 0, 0, 0.2);
  1534. }
  1535. }
  1536. }
  1537. }
  1538. }
  1539. }
  1540. &__modal {
  1541. .praised {
  1542. .cu-dialog {
  1543. width: 70%;
  1544. overflow: hidden;
  1545. image {
  1546. height: 100%;
  1547. }
  1548. }
  1549. }
  1550. }
  1551. }
  1552. /* Comp 悬浮创建按钮 */
  1553. .comp-fab {
  1554. position: fixed;
  1555. right: 24rpx;
  1556. /* 预留底部安全区/避免遮挡 */
  1557. bottom: 160rpx;
  1558. z-index: 999;
  1559. width: 96rpx;
  1560. height: 96rpx;
  1561. border-radius: 9999rpx;
  1562. background-color: #e6162c;
  1563. display: flex;
  1564. align-items: center;
  1565. justify-content: center;
  1566. /* #ifndef APP-NVUE */
  1567. box-shadow: 0 12rpx 24rpx rgba(230, 22, 44, 0.35);
  1568. /* #endif */
  1569. }
  1570. .comp-fab-text {
  1571. color: #fff;
  1572. font-size: 48rpx;
  1573. line-height: 48rpx;
  1574. font-weight: bold;
  1575. }
  1576. .myuser-tabbar-pad {
  1577. height: 160rpx;
  1578. width: 100%;
  1579. }
  1580. </style>