index.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. <template>
  2. <view class="workInfo">
  3. <!-- #ifdef H5 -->
  4. <view class="pad30" v-show="isShow">
  5. <view class='default acea-row row-middle borderRadius15'>
  6. <image :src="userInfo.avatar" mode="aspectFit" class="avatar"></image>
  7. <view class="acea-row row-middle">
  8. <view class="nick_name">{{userInfo.name}}</view>
  9. </view>
  10. </view>
  11. <view class='list acea-row row-middle borderRadius15'>
  12. <view class='item acea-row row-between-wrapper'>
  13. <view class='left_name'>手机号</view>
  14. <view class='right_name' v-if="userInfo.userInfo.phone">{{userInfo.userInfo.phone}}</view>
  15. <view class='right_name' v-else>暂无</view>
  16. </view>
  17. <view class='item acea-row row-between-wrapper'>
  18. <view class='left_name'>分组</view>
  19. <view class='right_name' v-if="userInfo.userInfo.userGroup">{{userInfo.userInfo.userGroup.group_name}}</view>
  20. <view class='right_name' v-else>暂无</view>
  21. </view>
  22. <view class='item acea-row row-between'>
  23. <view class='left_name'>用户标签</view>
  24. <view class='label acea-row' v-if="userInfo.userInfo.label && userInfo.userInfo.label.length">
  25. <view class="label_bdg acea-row row-middle row-center"
  26. v-for="(item,index) in userInfo.userInfo.label" :key="index">{{item.label_name}}</view>
  27. </view>
  28. <view class='right_name' v-else>暂无</view>
  29. </view>
  30. </view>
  31. <view class='list acea-row row-middle borderRadius15'>
  32. <view class='item acea-row row-between-wrapper'>
  33. <view class='left_name'>会员等级</view>
  34. <view class='right_name' v-if="userInfo.userInfo.level">{{userInfo.userInfo.level}}</view>
  35. <view class='right_name' v-else>暂无</view>
  36. </view>
  37. <view class='item acea-row row-between-wrapper'>
  38. <view class='left_name'>推荐人</view>
  39. <view class='right_name' v-if="userInfo.userInfo.spreadUser">{{userInfo.userInfo.spreadUser.nickname}}</view>
  40. <view class='right_name' v-else>暂无</view>
  41. </view>
  42. <view class='item acea-row row-between-wrapper'>
  43. <view class='left_name'>用户类型</view>
  44. <view class='right_name' v-if="userInfo.userInfo.user_type">{{userInfo.userInfo.user_type | user_type}}</view>
  45. <view class='right_name' v-else>暂无</view>
  46. </view>
  47. <view class='item acea-row row-between-wrapper'>
  48. <view class='left_name'>余额</view>
  49. <view class='right_name' v-if="userInfo.userInfo.now_money">{{userInfo.userInfo.now_money}}</view>
  50. <view class='right_name' v-else>暂无</view>
  51. </view>
  52. <view class='item acea-row row-between-wrapper'>
  53. <view class='left_name'>推广员</view>
  54. <view class='right_name'>{{userInfo.userInfo.spread_open ? '是' : '否'}}</view>
  55. </view>
  56. <view class='item acea-row row-between-wrapper'>
  57. <view class='left_name'>生日</view>
  58. <view class='right_name' v-if="userInfo.userInfo.birthday">{{userInfo.userInfo.birthday}}</view>
  59. <view class='right_name' v-else>暂无</view>
  60. </view>
  61. </view>
  62. <view style="height: 100px;"></view>
  63. <tNav :active="0"></tNav>
  64. <view class="tui-fab-box tui-fab-right" @click="groupBack()" v-if="backGroup">
  65. <text class="iconfont icon-fanhui3"></text>
  66. </view>
  67. </view>
  68. <!-- #endif -->
  69. </view>
  70. </template>
  71. <script>
  72. // #ifdef H5
  73. import { initWxConfig,initAgentConfig } from "@/libs/work.js";
  74. import {getWorkAgentInfo} from "@/api/work.js";
  75. import tNav from '../components/tabNav.vue';
  76. // import {wx} from "@/utils/agent.js"
  77. export default{
  78. data() {
  79. return {
  80. userId:"",
  81. isShow:false,
  82. userInfo:{
  83. userInfo:{
  84. real_name:"",
  85. level:"",
  86. user_type:"",
  87. now_money:"",
  88. spread_open:"",
  89. birthday:"",
  90. userGroup:{},
  91. label:[],
  92. }
  93. },
  94. backGroup:false
  95. }
  96. },
  97. filters:{
  98. user_type(val){
  99. if(val =='wechat'){
  100. return '公众号'
  101. }else if(val == 'routine'){
  102. return '小程序'
  103. }else if(val == 'h5'){
  104. return 'H5'
  105. }else if(val == 'app'){
  106. return 'APP'
  107. }
  108. }
  109. },
  110. components:{tNav},
  111. onLoad(e) {
  112. this.$Cache.clear('work_user_id')
  113. if(e.userid){
  114. this.userId = e.userid;
  115. this.backGroup = true;
  116. this.$Cache.set('work_user_id',e.userid)
  117. this.getInfo();
  118. }else{
  119. initWxConfig().then((jWeixin) => {
  120. this.getUserID();
  121. }).catch((err) => {
  122. console.log(err);
  123. return this.$util.Tips({
  124. title: err
  125. });
  126. });
  127. }
  128. // this.getInfo();
  129. },
  130. methods:{
  131. getUserID(){
  132. if (/(iPhone|iPad|iPod|iOS|macintosh|mac os x)/i.test(navigator.userAgent)){
  133. wx.invoke('getContext', {}, (res)=>{
  134. if(res.err_msg == "getContext:ok" && res.entry == "single_chat_tools"){
  135. let entry = res.entry ;
  136. //返回进入H5页面的入口类型,
  137. //目前有normal、contact_profile、single_chat_tools、group_chat_tools、chat_attachment
  138. wx.invoke('getCurExternalContact', {entry}, (response)=>{
  139. if(response.err_msg == "getCurExternalContact:ok"){
  140. //返回当前外部联系人userId
  141. this.userId = response.userId;
  142. this.$Cache.set('work_user_id',response.userId)
  143. this.getInfo();
  144. }
  145. });
  146. }else if(res.err_msg == "getContext:ok" && res.entry == "group_chat_tools"){
  147. uni.reLaunch({
  148. url:"/pages/work/groupInfo/index"
  149. })
  150. }
  151. });
  152. }else{
  153. jWeixin.invoke('getContext', {}, (res)=>{
  154. if(res.err_msg == "getContext:ok" && res.entry == "single_chat_tools"){
  155. let entry = res.entry ;
  156. //返回进入H5页面的入口类型,
  157. //目前有normal、contact_profile、single_chat_tools、group_chat_tools、chat_attachment
  158. jWeixin.invoke('getCurExternalContact', {entry}, (response)=>{
  159. if(response.err_msg == "getCurExternalContact:ok"){
  160. //返回当前外部联系人userId
  161. this.userId = response.userId;
  162. this.$Cache.set('work_user_id',response.userId)
  163. this.getInfo();
  164. }
  165. });
  166. }else if(res.err_msg == "getContext:ok" && res.entry == "group_chat_tools"){
  167. uni.reLaunch({
  168. url:"/pages/work/groupInfo/index"
  169. })
  170. }
  171. });
  172. }
  173. },
  174. getInfo(){
  175. getWorkAgentInfo({
  176. userid:this.userId,
  177. }).then(res=>{
  178. this.isShow = true;
  179. this.userInfo = res.data;
  180. }).catch(err=>{
  181. return this.$util.Tips({
  182. title: err
  183. });
  184. })
  185. },
  186. groupBack(){
  187. uni.navigateTo({
  188. url:"/pages/work/groupInfo/index?back=1"
  189. })
  190. }
  191. }
  192. }
  193. // #endif
  194. </script>
  195. <style lang="scss">
  196. /* #ifdef H5 */
  197. .workInfo{
  198. }
  199. .default {
  200. padding: 0 24rpx;
  201. height: 154rpx;
  202. background-color: #fff;
  203. margin-top: 24rpx;
  204. }
  205. .list {
  206. background-color: #fff;
  207. margin-top: 24rpx;
  208. .item{
  209. width: 100%;
  210. padding: 30rpx;
  211. .left_name{
  212. color: #666666;
  213. font-size: 30rpx;
  214. }
  215. .right_name{
  216. color: #333333;
  217. font-size: 30rpx;
  218. }
  219. .label{
  220. width: 440rpx;
  221. }
  222. .label_bdg{
  223. height: 44rpx;
  224. padding:4rpx 8rpx;
  225. background: rgba(24, 144, 255, 0.1);
  226. border-radius: 2px;
  227. margin-left: 16rpx;
  228. margin-bottom: 16rpx;
  229. font-size: 24rpx;
  230. font-family: PingFangSC-Regular, PingFang SC;
  231. font-weight: 400;
  232. color: #1890FF;
  233. }
  234. }
  235. }
  236. .avatar{
  237. width: 84rpx;
  238. height: 84rpx;
  239. border-radius: 50%;
  240. }
  241. .nick_name{
  242. font-size: 32rpx;
  243. font-weight: 500;
  244. margin: 0 12rpx 0;
  245. color: rgba(0, 0, 0, 0.65);
  246. }
  247. .badge{
  248. width: 56rpx;
  249. height: 28rpx;
  250. background: rgba(100, 64, 194, 0.16);
  251. border-radius: 4rpx;
  252. font-size: 20rpx;
  253. font-family: PingFangSC-Regular, PingFang SC;
  254. font-weight: 400;
  255. color: #6440C2;
  256. line-height: 20rpx;
  257. }
  258. .tui-fab-box {
  259. display: flex;
  260. justify-content: center;
  261. flex-direction: column;
  262. position: fixed;
  263. right:40px;
  264. bottom:100px;
  265. z-index: 99997;
  266. width: 64rpx;
  267. height: 64rpx;
  268. background: #FFFFFF;
  269. border-radius: 50%;
  270. box-shadow: 0px 0px 28rpx 0px rgba(0, 0, 0, 0.08);
  271. }
  272. .tui-fab-right {
  273. align-items: flex-end;
  274. }
  275. .iconfont{
  276. font-size: 40rpx;
  277. }
  278. /* #endif */
  279. </style>