myPage.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531
  1. <template>
  2. <view class="container my-container" v-if="haveData">
  3. <view class="top-content-box">
  4. <view
  5. class="nav-bar-wrap"
  6. :style="{ height: navBarStyle.height, paddingTop: navBarStyle.paddingTop, paddingBottom: navBarStyle.paddingBottom }"
  7. >
  8. <van-icon custom-class="search-icon" name="arrow-left" size="24px" @click="goBack" />
  9. </view>
  10. </view>
  11. <view class="my-background">
  12. <view class="my-notice" v-if="myNotice">
  13. 添加到我的小程序,做您手边的研究素材库👆
  14. <van-icon @click="myNotice = false" class="my-icon" name="cross" />
  15. </view>
  16. </view>
  17. <view class="my-info" v-if="isUserBindingPhoneNumber">
  18. <view class="my-top-info">
  19. <view class="info">
  20. <view class="info-img">
  21. <button class="avatar-wrapper" open-type="chooseAvatar" @chooseavatar="onChooseAvatar">
  22. <image class="avatar" v-if="headimgurl" :src="headimgurl"></image>
  23. <image src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/logo.png" class="avatar" v-else></image>
  24. </button>
  25. </view>
  26. <view class="info-list">
  27. <block v-if="isLogin">
  28. <text class="name">{{ userInfo.RealName || "--" }}</text>
  29. <text class="mobile">{{ userInfo.Mobile || userInfo.Email }}</text>
  30. <text class="company-name">{{ userInfo.CompanyName || "--" }}</text>
  31. </block>
  32. <block v-else>
  33. <text class="name">Hi,请绑定联系方式~</text>
  34. <text class="bind-btn" @click="loginHandle">绑定联系方式</text>
  35. </block>
  36. </view>
  37. </view>
  38. <view class="auth-info">
  39. <template v-if="isLogin">
  40. <scroll-view scroll-x="true" scroll-with-animation class="auth-ul" v-if="userInfo.HasPermission === 0">
  41. <text class="auth-li" v-for="item in authList" :key="item">{{ item }}</text>
  42. </scroll-view>
  43. <block v-else>
  44. <button class="auth-btn" @click="applyAuth" v-if="userInfo.HasPermission != 3">申请开通权限</button>
  45. </block>
  46. </template>
  47. <text v-else class="no-auth">暂无品种权限信息</text>
  48. </view>
  49. <view class="info-item">
  50. <view class="item" @click="itemClickHandle('活动日程')">
  51. <text class="item-number">{{ userInfo.ScheduleNum }}</text>
  52. <text class="item-text">活动日程</text>
  53. </view>
  54. <view class="item item-label" @click="itemClickHandle('我的收藏')">
  55. <text class="item-number">{{ userInfo.ConNum }}</text>
  56. <text class="item-text">收藏</text>
  57. </view>
  58. <view class="item" @click="itemClickHandle('我的足迹')">
  59. <text class="item-number">{{ userInfo.HistoryNum }}</text>
  60. <text class="item-text">足迹</text>
  61. </view>
  62. </view>
  63. </view>
  64. <view class="info-bot">
  65. <view class="list-item border_bottom" v-for="type in typeArr" :key="type" @click="itemClickHandle(type)">
  66. <text>{{ type }}</text>
  67. <view class="my-bot-box">
  68. <block v-if="type == '外呼号码'">
  69. <text v-if="userInfo.OutboundCountryCode && userInfo.OutboundMobile" style="margin-right: 40rpx; font-size: 28rpx"
  70. >{{ userInfo.OutboundCountryCode }}-{{ userInfo.OutboundMobile }}</text
  71. >
  72. <text v-else style="margin-right: 40rpx; font-size: 28rpx">未设置</text>
  73. </block>
  74. <block v-if="type == '关注公众号'">
  75. <text style="margin-right: 20rpx; font-size: 28rpx">查研观向小助手</text>
  76. </block>
  77. <block v-if="type == 'PC网页版'">
  78. <text @click="copyPcWebUrl" style="margin-right: 20rpx; font-size: 28rpx; color: #3385ff">web.hzinsights.com</text>
  79. </block>
  80. <u-icon v-if="type != 'PC网页版'" name="arrow-right" color="#BDBDBD" size="34"></u-icon>
  81. </view>
  82. </view>
  83. </view>
  84. <view class="bottom-text">您手边的研究素材库</view>
  85. </view>
  86. <view v-else class="not-bind-login">
  87. <not-have-login />
  88. <view class="bottom-text">您手边的研究素材库</view>
  89. </view>
  90. <freeCharge class="free-charge" :isShowFreeBtn="isShowFree" />
  91. </view>
  92. </template>
  93. <script>
  94. import { uploadurl, Mine, checkToken, User } from "@/config/api.js";
  95. import freeCharge from "@/components/freeCharge";
  96. import NotHaveLogin from "../../components/notHaveLogin.vue";
  97. let app = getApp();
  98. export default {
  99. components: {
  100. freeCharge,
  101. NotHaveLogin,
  102. },
  103. data() {
  104. return {
  105. isLogin: false, //是否绑定且授权
  106. haveData: null, //显示页面
  107. typeArr: [],
  108. typeObj: new Map([
  109. ["外呼号码", "editOutbound"],
  110. ["活动提问", "myAskPage"],
  111. ["我的留言", "myLeavingMessage"],
  112. ["优化建议", "advice"],
  113. ["关于我们", "followUs"],
  114. ["产品内测", "internalTesting"],
  115. ["关注公众号", "accountsOfficial"],
  116. ["我的足迹", "browseHistory"],
  117. ["活动日程", "mySchedulepage"],
  118. ["我的收藏", "myCollection"],
  119. ]),
  120. userInfo: {},
  121. authList: [],
  122. myNotice: true,
  123. headimgurl: "",
  124. };
  125. },
  126. onShow() {
  127. this.haveData = true;
  128. if (!this.$store.state.isAuth && !this.$store.state.isBind) {
  129. //已授权已绑定
  130. this.isLogin = true;
  131. this.getUser();
  132. } else {
  133. this.isLogin = false;
  134. }
  135. },
  136. watch: {
  137. "wholeShowListData.IsBelongRai": {
  138. handler(newVal) {
  139. this.typeArr = ["外呼号码", "活动提问", "我的留言", "优化建议", "关于我们", "产品内测", "关注公众号", "PC网页版"];
  140. if (!newVal) {
  141. this.typeArr.splice(5, 1);
  142. }
  143. },
  144. deep: true,
  145. },
  146. },
  147. methods: {
  148. //获取胶囊位置
  149. initNavBar() {
  150. let menuButtonInfo = uni.getMenuButtonBoundingClientRect();
  151. this.navBarStyle = {
  152. height: menuButtonInfo.height + menuButtonInfo.top + 8 + "px",
  153. paddingTop: menuButtonInfo.top - 4 + "px",
  154. paddingBottom: "4px",
  155. };
  156. },
  157. // 返回
  158. goBack() {
  159. uni.navigateBack();
  160. },
  161. //点击了头像
  162. onChooseAvatar(e) {
  163. this.getRecordTracking("头像");
  164. let token = this.$db.get("access_token");
  165. let authHeader = token || "";
  166. let that = this;
  167. uni.uploadFile({
  168. url: uploadurl,
  169. filePath: e.detail.avatarUrl,
  170. header: {
  171. "Content-Type": "multipart/form-data",
  172. Authorization: authHeader,
  173. },
  174. name: "file",
  175. success(res) {
  176. let data = JSON.parse(res.data);
  177. that.headimgurl = data.Data.ResourceUrl;
  178. User.headimgurlUpdate({ Headimgurl: data.Data.ResourceUrl });
  179. },
  180. });
  181. },
  182. /* 检查状态 */
  183. /* 获取用户信息 */
  184. getUser() {
  185. Mine.getInfo().then((res) => {
  186. if (res.Ret === 200) {
  187. this.authList = res.Data.PermissionName && res.Data.PermissionName.split(",");
  188. this.userInfo = res.Data;
  189. this.headimgurl = res.Data.Headimgurl;
  190. res.Data.Mobile && this.$db.set("mobile", res.Data.Mobile);
  191. }
  192. });
  193. },
  194. /* 点击登录 检验是否绑定或是否授权*/
  195. loginHandle() {
  196. /* 先授权再绑定 */
  197. if (this.$store.state.isAuth) {
  198. uni.navigateTo({
  199. url: "/pageMy/authGuide/authGuide",
  200. });
  201. } else {
  202. this.$store.state.isBind &&
  203. uni.navigateTo({
  204. url: "/pageMy/login/login",
  205. });
  206. }
  207. },
  208. /* 申请开通权限 */
  209. applyAuth() {
  210. /* 查看是否是潜在用户 */
  211. this.userInfo.HasPermission === 1
  212. ? User.applyTry({
  213. ApplyMethod: 3,
  214. }).then((res) => {
  215. if (res.Ret === 200) {
  216. uni.navigateTo({
  217. url: "/pageMy/applyResult/applyResult",
  218. });
  219. }
  220. })
  221. : this.userInfo.HasPermission === 2
  222. ? uni.navigateTo({
  223. url: "/pageMy/applyTrial/applyTrial",
  224. })
  225. : this.userInfo.HasPermission === 3
  226. ? uni.showModal({
  227. title: "",
  228. content: "您已经提交过申请了,请耐心等待",
  229. showCancel: false,
  230. confirmColor: "#365595",
  231. success: function (res) {},
  232. })
  233. : "";
  234. },
  235. /* 路径跳转 */
  236. itemClickHandle(type) {
  237. let istype = type === "关注公众号" || type === "优化建议" || type === "外呼号码" ? type : "";
  238. istype && this.getRecordTracking("istype");
  239. /* 是否登录 */
  240. if (this.isLogin) {
  241. switch (type) {
  242. case "外呼号码":
  243. uni.navigateTo({
  244. url: "/activityPages/editOutbound/editOutbound?title=设置外呼号码&identification=我的",
  245. });
  246. break;
  247. case "关注公众号":
  248. uni.navigateTo({
  249. url: "/activityPages/accountsOfficial/accountsOfficial",
  250. });
  251. break;
  252. case "活动提问":
  253. uni.navigateTo({
  254. url: "/reportPages/myAskPage/myAskPage",
  255. });
  256. break;
  257. case "产品内测":
  258. uni.navigateTo({
  259. url: "/reportPages/internalTesting/internalTesting",
  260. });
  261. break;
  262. case "PC网页版":
  263. "";
  264. break;
  265. default:
  266. let path = this.typeObj.get(type);
  267. uni.navigateTo({
  268. url: `/pageMy/${path}/${path}`,
  269. });
  270. }
  271. } else {
  272. this.loginHandle();
  273. }
  274. },
  275. // 复制网页链接
  276. copyPcWebUrl() {
  277. uni.setClipboardData({
  278. data: "web.hzinsights.com",
  279. success: function () {
  280. uni.showToast({
  281. title: "已复制到剪贴板",
  282. icon: "none",
  283. duration: 2000,
  284. });
  285. },
  286. });
  287. },
  288. },
  289. onLoad() {
  290. this.initNavBar();
  291. },
  292. };
  293. </script>
  294. <style lang="scss" scoped>
  295. .my-container {
  296. background: #f9f9f9;
  297. position: relative;
  298. .top-content-box {
  299. position: sticky;
  300. top: 0;
  301. left: 0;
  302. width: 100%;
  303. z-index: 9;
  304. }
  305. .nav-bar-wrap {
  306. width: 100%;
  307. padding-left: 35rpx;
  308. display: flex;
  309. align-items: center;
  310. position: relative;
  311. .search-icon {
  312. position: absolute;
  313. left: 34rpx;
  314. top: 50%;
  315. transform: translateY(-50%);
  316. }
  317. }
  318. .nav-bar-wrap {
  319. color: #fff;
  320. position: fixed;
  321. top: 0;
  322. left: 0;
  323. width: 100%;
  324. z-index: 999;
  325. }
  326. .my-background {
  327. height: 480rpx;
  328. width: 100%;
  329. background: url("https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/my_bg.jpg") no-repeat;
  330. background-size: 100% 100%;
  331. padding-top: 206rpx;
  332. .my-notice {
  333. height: 55rpx;
  334. width: 690rpx;
  335. margin: 0 auto;
  336. background: rgba(255, 255, 255, 0.5);
  337. border-radius: 8px;
  338. line-height: 55rpx;
  339. text-align: center;
  340. color: #ffffff;
  341. position: relative;
  342. padding-right: 20rpx;
  343. .my-icon {
  344. position: absolute;
  345. right: 20rpx;
  346. top: 50%;
  347. transform: translateY(-50%);
  348. font-weight: bold;
  349. font-size: 16px;
  350. }
  351. }
  352. }
  353. .my-info {
  354. position: absolute;
  355. top: 301rpx;
  356. left: 50%;
  357. transform: translateX(-50%);
  358. padding-bottom: 100rpx;
  359. padding-bottom: calc(100rpx + constant(safe-area-inset-bottom));
  360. padding-bottom: calc(100rpx + env(safe-area-inset-bottom));
  361. .my-top-info {
  362. width: 690rpx;
  363. margin: 0 auto;
  364. height: 436rpx;
  365. background: url("https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/my_log.png") no-repeat;
  366. background-color: #ffffff;
  367. background-position: right top;
  368. background-size: 267rpx 274rpx;
  369. box-sizing: border-box;
  370. box-shadow: 0px 0rpx 7rpx 1rpx #f0f3f5;
  371. border-radius: 8rpx;
  372. .info {
  373. padding: 61rpx 0 0 30rpx;
  374. display: flex;
  375. .info-img {
  376. width: 126rpx;
  377. height: 126rpx;
  378. background: #c4c4c4;
  379. border-radius: 50%;
  380. overflow: hidden;
  381. .avatar-wrapper {
  382. width: 126rpx;
  383. height: 126rpx;
  384. }
  385. .avatar {
  386. width: 126rpx;
  387. height: 126rpx;
  388. border-radius: 50%;
  389. }
  390. }
  391. .info-list {
  392. display: flex;
  393. flex-direction: column;
  394. justify-content: space-between;
  395. margin-left: 32rpx;
  396. font-size: 24rpx;
  397. font-weight: 400;
  398. color: #666666;
  399. .name {
  400. font-size: 30rpx;
  401. color: #000000;
  402. line-height: 35rpx;
  403. font-weight: 500;
  404. }
  405. .bind-btn {
  406. color: #3385ff;
  407. width: 181rpx;
  408. height: 49rpx;
  409. background: #ffffff;
  410. border-radius: 8rpx;
  411. border: 2rpx solid #3385ff;
  412. text-align: center;
  413. line-height: 47rpx;
  414. }
  415. }
  416. }
  417. .auth-info {
  418. width: 100%;
  419. overflow: hidden;
  420. margin-top: 36rpx;
  421. .auth-ul {
  422. white-space: nowrap;
  423. padding: 0 30rpx;
  424. color: #3385ff;
  425. .auth-li {
  426. display: inline-block;
  427. padding: 1rpx 20rpx;
  428. border: 1rpx solid #3385ff;
  429. border-radius: 4rpx;
  430. font-size: 24rpx;
  431. margin-right: 20rpx;
  432. background: #edf4ff;
  433. &:last-child {
  434. margin-right: 50rpx;
  435. }
  436. }
  437. }
  438. .no-auth {
  439. text-align: center;
  440. font-size: 28rpx;
  441. color: #999999;
  442. }
  443. .auth-btn {
  444. width: 181rpx;
  445. height: 49rpx;
  446. margin: 0 auto;
  447. color: #3385ff;
  448. font-size: 24rpx;
  449. line-height: 47rpx;
  450. border: 2rpx solid #3385ff;
  451. }
  452. }
  453. .info-item {
  454. display: flex;
  455. padding-left: 30rpx;
  456. margin: 36rpx auto 0;
  457. .item {
  458. width: 208rpx;
  459. height: 76rpx;
  460. display: flex;
  461. flex-direction: column;
  462. justify-content: space-between;
  463. text-align: center;
  464. .item-number {
  465. font-size: 40rpx;
  466. font-weight: 500;
  467. }
  468. }
  469. .item-label {
  470. border-right: 1rpx solid #ececec;
  471. border-left: 1rpx solid #ececec;
  472. }
  473. }
  474. }
  475. .info-bot {
  476. padding: 0 20rpx;
  477. background-color: #fff;
  478. box-shadow: 0px 0rpx 7rpx 1rpx #f0f3f5;
  479. border-radius: 8rpx;
  480. margin-top: 20rpx;
  481. .list-item {
  482. display: flex;
  483. align-items: center;
  484. justify-content: space-between;
  485. font-size: 34rpx;
  486. color: #4a4a4a;
  487. padding: 33rpx 34rpx;
  488. .icon-area {
  489. width: 100rpx;
  490. }
  491. &:last-child {
  492. position: static;
  493. }
  494. }
  495. .my-bot-box {
  496. display: flex;
  497. }
  498. }
  499. }
  500. .bottom-text {
  501. position: absolute;
  502. background: #f9f9f9;
  503. bottom: 80rpx;
  504. right: 0;
  505. z-index: 9;
  506. font-size: 20rpx;
  507. color: #999999;
  508. width: 100%;
  509. text-align: center;
  510. }
  511. .not-bind-login {
  512. position: absolute;
  513. top: 301rpx;
  514. left: 50%;
  515. transform: translateX(-50%);
  516. width: 95%;
  517. height: 1234rpx;
  518. background-color: #fff;
  519. border-radius: 8rpx;
  520. border: 1px solid #ececec;
  521. .bottom-text {
  522. position: absolute;
  523. bottom: -50rpx;
  524. }
  525. }
  526. }
  527. </style>