index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427
  1. <template>
  2. <view class="person_wrap">
  3. <template v-if="userInfo.userId">
  4. <view class="navbar-wrap">
  5. <view class="column" :class="{fixed : isFixedTop}" :style="{background: background}" id="navbar">
  6. <view class="left"></view>
  7. <view style="font-size:36rpx" class="center">我的</view>
  8. <view class="right" @click="handleSetting">
  9. <u-icon name="setting" color="#333"></u-icon>
  10. </view>
  11. </view>
  12. <!-- <view class="column" v-if="isFixedTop"></view> -->
  13. </view>
  14. <view class="header_wrap">
  15. <view class="header_top_wrap">
  16. <view class="header_info_left">
  17. <u-avatar @click="handleAvatarClick" :src="$avatar(userInfo.avatar)" size="100rpx"></u-avatar>
  18. <view class="info_wrap">
  19. <view class="info_top">
  20. <text class="follow_name">{{userInfo.userName}}</text>
  21. <u-switch v-model="onlineStatus" active-value='0' inactive-value='1' :loading="onlineLoading" @change="changeOnlineStatus"></u-switch>
  22. <text class="identity">{{ onlineStatus === '0' ? '上线' : '下线' }}</text>
  23. </view>
  24. <view class="info_bottom">
  25. <text>{{userInfo.phonenumber}}</text>
  26. </view>
  27. </view>
  28. </view>
  29. <view class="header_info_right" @click="toPersonal">
  30. <u-icon name="arrow-right" color="#aaa"></u-icon>
  31. </view>
  32. </view>
  33. <view class="parson_menu_wrap">
  34. <view class="parson_menu_list">
  35. <navigator url="/pages/publicClue/index" open-type="switchTab" class="menu_item" hover-class="none">
  36. <image src="@/static/parson/icon-wf.png" mode=""></image>
  37. <text>销售公海</text>
  38. </navigator>
  39. <navigator url='/pages/message/index' open-type="navigate" class="menu_item" hover-class="none">
  40. <image src="@/static/parson/icon-myMessage.png" mode=""></image>
  41. <text>我的消息</text>
  42. </navigator>
  43. <navigator url='/pages/acceptOrderOrder/index' open-type="navigate" class="menu_item" hover-class="none">
  44. <image src="@/static/parson/icon-mycase.png" mode=""></image>
  45. <text>接单中心</text>
  46. </navigator>
  47. <navigator url='/pages/privateClue/index' open-type="switchTab" class="menu_item" hover-class="none">
  48. <image src="@/static/parson/clue.png" mode=""></image>
  49. <text>销售线索</text>
  50. </navigator>
  51. </view>
  52. </view>
  53. </view>
  54. <view class="cards_wrap">
  55. <cards></cards>
  56. </view>
  57. </template>
  58. <u-loading-page :loading="true" v-else></u-loading-page>
  59. </view>
  60. </template>
  61. <script>
  62. import cards from "./cards/index.vue"
  63. import permision from "@/js_sdk/wa-permission/permission.js";
  64. export default {
  65. components: {
  66. cards
  67. },
  68. data() {
  69. return {
  70. onlineLoading : false,
  71. switchSystemShow: false,
  72. navbarInitTop: 0, //导航栏初始化距顶部的距离
  73. isFixedTop: true, //是否固定顶部
  74. background: "", // 为了实现渐变背景颜色
  75. };
  76. },
  77. computed: {
  78. userInfo(){
  79. return this.$store.state.user.userInfo;
  80. },
  81. onlineStatus : {
  82. get(){
  83. return this.$store.state.user.userInfo.onlineStatus;
  84. },
  85. set(val){
  86. this.$store.commit("user/SET_USER_ONLINE_STATUS",val);
  87. },
  88. },
  89. nickName(){
  90. return this.userInfo.nickName;
  91. },
  92. userName(){
  93. return this.userInfo.userName;
  94. },
  95. deptName(){
  96. return this.userInfo.newOrgName;
  97. },
  98. time(){
  99. return this.$dayjs().format("YYYY-MM-DD HH:mm:ss")
  100. },
  101. systemList(){
  102. return this.$store.state.user.systemList;
  103. },
  104. filterSystemList() {
  105. return this.systemList.filter(v => this.userInfo.subsystemList.some(u => v.value === u.systemCode));
  106. },
  107. currentSystem: {
  108. get() {
  109. return this.$store.getters.system.value
  110. },
  111. set(val) {
  112. const system = this.systemList.find(v => v.value === val);
  113. // 如果有没保存的催记直接清掉
  114. this.$store.commit("follow/SET_FORM", {});
  115. this.$store.commit("follow/SET_PARAMS", {});
  116. this.$store.commit("user/SET_SYSTEM", system);
  117. this.$store.commit("user/SET_BELONGSYSTEM", {
  118. code: val,
  119. callback: (flag) => {
  120. if (flag) {
  121. setTimeout(() => {
  122. // 定时器可加可不加
  123. uni.reLaunch({
  124. url: "/pages/person/index",
  125. success: () => {
  126. uni.$u.toast("切换成功,当前为" + system.text);
  127. }
  128. })
  129. }, 300)
  130. } else {
  131. this.$store.commit("user/SET_TOKEN", "");
  132. this.$store.commit("user/SET_USERINFO", {});
  133. uni.reLaunch({
  134. url: "/pages/login/index",
  135. success() {
  136. uni.$u.toast("请检查您是否有该系统权限");
  137. }
  138. })
  139. }
  140. }
  141. })
  142. },
  143. },
  144. },
  145. methods: {
  146. changeOnlineStatus(val){
  147. this.onlineLoading = true;
  148. uni.$u.api.changeOnlineStatus({ userId: this.$store.state.user.userInfo.userId, onlineStatus : val });
  149. this.onlineLoading = false;
  150. },
  151. handleTest(){
  152. uni.navigateTo({
  153. url: "/pages/demo/demo"
  154. })
  155. },
  156. // 确认选择系统事件
  157. handleSystemConfirm() {
  158. },
  159. // 取消选择系统事件
  160. handleSystemCancel() {
  161. },
  162. // 点击打开选择系统
  163. handleSwitchSystem() {
  164. this.$refs.switch.showModal();
  165. },
  166. onPullDownRefresh() {
  167. uni.stopPullDownRefresh();
  168. this.$store.dispatch("user/getUserInfo");
  169. },
  170. toPersonal() {
  171. uni.navigateTo({
  172. url: "/pages/profile/index"
  173. })
  174. },
  175. handleSetting() {
  176. uni.navigateTo({
  177. url: "/pages/setting/index"
  178. })
  179. },
  180. registerFun() {
  181. if(!this.$store.state.app.callSystem){
  182. this.$store.dispatch("app/getExtensionByUserId", {
  183. userId: this.$store.state.user.userInfo.userId
  184. }).then((res) => {
  185. Promise.all([permision.requestAndroidPermission("android.permission.RECORD_AUDIO"),permision.requestAndroidPermission('android.permission.MODIFY_AUDIO_SETTINGS')]).then(result=>{
  186. const flag = result.every(v=>v == 1);
  187. if(flag){
  188. this.$store.dispatch("app/createWv");
  189. }
  190. })
  191. });
  192. }
  193. },
  194. handleAvatarClick(){
  195. //跳转个人资料
  196. uni.navigateTo({
  197. url: "/pages/profile/index"
  198. })
  199. }
  200. },
  201. mounted() {
  202. if (this.navbarInitTop == 0) {
  203. const query = uni.createSelectorQuery().in(this);
  204. //获取节点距离顶部的距离
  205. query.select("#navbar").boundingClientRect(function(rect) {
  206. if (rect && rect.top > 0) {
  207. var navbarInitTop = parseInt(rect.top);
  208. this.navbarInitTop = navbarInitTop;
  209. }
  210. }).exec();
  211. }
  212. if(this.$store.state.user.token){
  213. this.$store.dispatch("user/getUserInfo");
  214. }else{
  215. uni.navigateTo({
  216. url: "/pages/login/index"
  217. })
  218. }
  219. },
  220. /**
  221. * 监听页面滑动事件
  222. */
  223. onPageScroll: function(e) {
  224. var scrollTop = parseInt(e.scrollTop); //滚动条距离顶部高度
  225. this.background = `rgba(255, 255, 255,${scrollTop / (scrollTop + 60)})`;
  226. //判断'滚动条'滚动的距离 和 '元素在初始时'距顶部的距离进行判断
  227. var isSatisfy = scrollTop >= this.navbarInitTop ? true : false;
  228. //为了防止不停的setData, 这儿做了一个等式判断。 只有处于吸顶的临界值才会不相等
  229. if (this.isFixedTop === isSatisfy) {
  230. return false;
  231. }
  232. this.isFixedTop = isSatisfy;
  233. }
  234. };
  235. </script>
  236. <style>
  237. .watermarkCans {
  238. width: 250rpx;
  239. height: 250rpx;
  240. position: absolute;
  241. z-index: -1;
  242. }
  243. </style>
  244. <style lang="scss" scoped>
  245. .switchSysytemSelect {
  246. height: 0rpx;
  247. overflow: hidden;
  248. }
  249. .switchSysytemBtn {
  250. width: 630rpx;
  251. margin: auto;
  252. margin-top: 60rpx;
  253. ::v-deep .u-button {
  254. border-radius: 100rpx;
  255. }
  256. }
  257. .person_wrap {
  258. background-size: cover;
  259. background-repeat: no-repeat;
  260. // padding: 0 30rpx;
  261. position: relative;
  262. height: 100vh;
  263. .header_wrap {
  264. box-sizing: border-box;
  265. background: url("@/static/parson/parson_background.png");
  266. background-size: cover;
  267. width: 750rpx;
  268. // position: absolute;
  269. // top: 0;
  270. // left: 0;
  271. padding: 170rpx 30rpx 0 30rpx;
  272. .header_top_wrap {
  273. display: flex;
  274. justify-content: space-between;
  275. align-items: center;
  276. .header_info_left {
  277. display: flex;
  278. align-items: center;
  279. // image {
  280. // width: 100rpx;
  281. // height: 100rpx;
  282. // margin-right: 30rpx;
  283. // border-radius: 50%;
  284. // }
  285. .info_wrap {
  286. margin-left: 20rpx;
  287. .info_top {
  288. margin-bottom: 20rpx;
  289. display: flex;
  290. align-items: center;
  291. .follow_name {
  292. font-size: 32rpx;
  293. color: #202020;
  294. font-weight: bold;
  295. margin-right: 20rpx;
  296. }
  297. .identity {
  298. display: inline-block;
  299. width: 100rpx;
  300. line-height: 36rpx;
  301. background: #ffffff;
  302. border-radius: 18px;
  303. text-align: center;
  304. font-size: 22rpx;
  305. color: #666666;
  306. margin-left: 10px;
  307. }
  308. }
  309. .info_bottom {
  310. text {
  311. font-size: 28rpx;
  312. color: #666666;
  313. }
  314. }
  315. }
  316. }
  317. .header_info_right {
  318. ::v-deep .u-icon__icon {
  319. font-size: 30rpx !important;
  320. }
  321. }
  322. }
  323. .parson_menu_wrap {
  324. background: #ffffff;
  325. border-radius: 20px;
  326. box-shadow: 0px 4px 20px 0px rgba(16, 140, 255, 0.10);
  327. margin-top: 58rpx;
  328. .parson_menu_list {
  329. display: flex;
  330. padding: 40rpx 0;
  331. .menu_item {
  332. width: 33%;
  333. display: flex;
  334. flex-direction: column;
  335. align-items: center;
  336. image {
  337. width: 48rpx;
  338. height: 48rpx;
  339. margin-bottom: 24rpx;
  340. }
  341. text {
  342. font-size: 28rpx;
  343. color: #202020;
  344. }
  345. }
  346. }
  347. }
  348. }
  349. .cards_wrap{
  350. padding:0 30rpx 0 30rpx;
  351. }
  352. .box {
  353. height: 200vh;
  354. }
  355. }
  356. .navbar-wrap {
  357. width: 750rpx;
  358. .left {
  359. width: 70rpx;
  360. }
  361. .right {
  362. margin-right: 30rpx;
  363. ::v-deep .u-icon__icon {
  364. font-size: 40rpx !important;
  365. }
  366. }
  367. }
  368. .navbar-wrap .column {
  369. box-sizing: border-box;
  370. padding-top: 60rpx;
  371. width: 750rpx;
  372. height: 170rpx;
  373. display: flex;
  374. justify-content: space-between;
  375. align-items: center;
  376. background: transparent;
  377. top: 0;
  378. left: 0;
  379. z-index: 100;
  380. }
  381. .navbar-wrap .column.fixed {
  382. width: 750rpx;
  383. position: fixed;
  384. }
  385. .navbar-wrap .column .center {
  386. text-align: center;
  387. font-size: 36rpx;
  388. color: #333333;
  389. letter-spacing: 1px;
  390. position: relative;
  391. }
  392. </style>