center.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. <template>
  2. <div class="center myCenter">
  3. <!-- 头部 -->
  4. <header>
  5. <div class="beijin"></div>
  6. <div class="flex aic users pixed" style="width:50%;">
  7. <img :src="require('../../../assets/img/personal/userHead.png')" class="imege" />
  8. <span class="f16 fff ml-20" v-if="userInfo.userNameNeedTranslate == '1'"><ww-open-data type='userName' :openid='userInfo.name'></ww-open-data></span>
  9. <span class="f16 fff ml-20" v-else>{{userInfo.name}} </span>
  10. </div>
  11. </header>
  12. <!-- 主体 -->
  13. <main class="mt-10">
  14. <div class="bg-fff">
  15. <van-cell title="当前版本" :title-style="'flex: 0.5;'" :value="version"></van-cell>
  16. <div style="height: 20px;background: #f4f4f4"></div>
  17. <van-cell title="账号" v-if="userInfo.userNameNeedTranslate != '1'" :title-style="'flex: 0.5;'" :value="userInfo.phone"></van-cell>
  18. <van-cell title="工号" v-if="userInfo.jobNumber" :title-style="'flex: 0.5;'" :value="userInfo.jobNumber"></van-cell>
  19. <div style="height: 20px;background: #f4f4f4"></div>
  20. <van-cell title="公司" :title-style="'flex: 0.5;'" :value="userInfo.companyName"></van-cell>
  21. <van-cell title="有效日期" :title-style="'flex: 0.5;'" :value="expirationDate"></van-cell>
  22. <div style="height: 20px;background: #f4f4f4"></div>
  23. <van-cell title="使用说明" :title-style="'flex: 1;'" is-link @click="instructions()"></van-cell>
  24. <van-cell title="在线客服" :title-style="'flex: 1;'" is-link @click="tokefu()" v-if="isCorpWX"></van-cell>
  25. <van-cell title="添加员工" :title-style="'flex: 1;'" is-link @click="addEmployee()" v-if="isCorpWX"></van-cell>
  26. <!-- <van-cell title="修改密码" isLink to="/my/set"></van-cell> -->
  27. </div>
  28. <van-cell :title="'绑定'+(isCorpWX?'企业':'')+'微信'" v-if="userInfo.userNameNeedTranslate != '1' && (isCorpWX || isWX)" @click="bindWeiXin" style="margin-top:10px;" :title-style="'flex: 2.5;'" label="绑定微信后可接收工时填报提醒">
  29. <template>
  30. <span v-if="(isCorpWX && userInfo.corpwxUserid == null) || (isWX && userInfo.wxOpenid == null)" style="color:#ff0000;">未绑定</span>
  31. <span v-if="(isCorpWX && userInfo.corpwxUserid != null) || (isWX && userInfo.wxOpenid != null)" style="color:#7CCD7C;">已绑定</span>
  32. </template>
  33. </van-cell>
  34. <van-button class="logout" @click="logout" block round type="danger" v-if="!isCorpWX">退出登录</van-button>
  35. <!-- <van-button class="logout" @click="logout" block round type="danger" >退出登录</van-button> -->
  36. </main>
  37. <Footer page="my" />
  38. </div>
  39. </template>
  40. <script>
  41. import Footer from "@/components/Footer";
  42. import { mapGetters } from "vuex";
  43. export default {
  44. components: {
  45. Footer
  46. },
  47. computed: {
  48. ...mapGetters(["userId", "isLogin"])
  49. },
  50. data() {
  51. return {
  52. userInfo: JSON.parse(localStorage.userInfo),
  53. isCorpWX:false,
  54. isWX:false,
  55. expirationDate: '', // 有效日期
  56. version: '', // 版本
  57. show: false
  58. }
  59. },
  60. methods: {
  61. logout() {
  62. this.$store.commit("updateLogin", false);
  63. localStorage.removeItem("userInfo");
  64. this.$router.push("/login");
  65. },
  66. bindWeiXin(){
  67. //企业微信
  68. if (this.isCorpWX && this.userInfo.corpwxUserid != null) {
  69. return;
  70. }
  71. //微信
  72. else if (this.isWX && this.userInfo.wxOpenid != null) {
  73. return;
  74. }
  75. var appId = "wx749c84daac654e1e";//工时管家公众号
  76. if (this.isCorpWX) {
  77. appId = "ww4e237fd6abb635af"; //企业微信第三方的SUIT ID
  78. }
  79. var url = "http://worktime.ttkuaiban.com/api/wxcorp/bindCorpWeiXin?userId="+this.userInfo.id;//授权回调页面
  80. var weixinUrl="https://open.weixin.qq.com/connect/oauth2/authorize?appid="+appId+"&redirect_uri="+encodeURI(url)+"&response_type=code&scope=snsapi_base&state=0#wechat_redirect";
  81. window.location.href = weixinUrl;
  82. },
  83. // 使用说明
  84. instructions() {
  85. console.log('当前版本')
  86. let url = 'https://www.ttkuaiban.com/download/%E5%B7%A5%E6%97%B6%E7%AE%A1%E5%AE%B6%E7%AE%A1%E7%90%86%E7%B3%BB%E7%BB%9F%E4%BD%BF%E7%94%A8%E8%AF%B4%E6%98%8E%E4%B9%A6.pdf'
  87. let name = '使用说明书'
  88. this.previewPDF(url, name)
  89. },
  90. // 预览pdf
  91. previewPDF(url, name) {
  92. this.$router.push({
  93. path: '/pdf',
  94. query: {
  95. url: url,
  96. name: name
  97. }
  98. })
  99. // this.$refs.previewPdfh5.openPdf('http://celiang.oss-cn-hangzhou.aliyuncs.com/measurement/2022-01/18/75it6phpocqYFV1642488558220118.pdf')
  100. },
  101. // 添加员工
  102. addEmployee() {
  103. wx.invoke('openAppManage', {}, function(res){
  104. if(res.err_msg == "openAppManage:ok") {
  105. // 调用成功
  106. }
  107. if(res.err_msg == "openAppManage:fail:no permission") {
  108. // 调用人身份不符合
  109. this.$message({message: '调用人身份不符合',type: "error"});
  110. }
  111. if(res.err_msg == "openAppManage:fail:unknown app") {
  112. // 应用信息获取失败
  113. this.$message({message: '应用信息获取失败',type: "error"});
  114. }
  115. if(res.err_msg == "openAppManage:fail:unsupported app type") {
  116. // 应用类型不符合要求
  117. this.$message({message: '应用类型不符合要求',type: "error"});
  118. }
  119. if(res.err_msg == "openAppManage:fail") {
  120. // 其它错误
  121. this.$message({message: '其它错误',type: "error"});
  122. }
  123. })
  124. },
  125. // 跳转客服
  126. tokefu(){
  127. wx.invoke('openThirdAppServiceChat', {
  128. }, function(res) {
  129. console.log('invoke',res);
  130. if (res.err_msg == "openThirdAppServiceChat:ok" || res.err_msg == "openThirdAppServiceChat:cancel") {
  131. }else{
  132. this.$toast.fail('请联系管理员添加客服');
  133. }
  134. }
  135. );
  136. },
  137. },
  138. create() {
  139. },
  140. mounted() {
  141. var ua = navigator.userAgent.toLowerCase();
  142. if (ua.indexOf("wxwork") > 0) {
  143. this.isCorpWX = true;
  144. } else if (ua.indexOf("micromessenger") > 0) {
  145. this.isWX = true;
  146. }
  147. // 拼接有效日期 和 版本
  148. if(localStorage.userInfo) {
  149. // 日期
  150. let userss = JSON.parse(localStorage.userInfo)
  151. userss.createTime[1] >= 10 ? userss.createTime[1] : userss.createTime[1] = '0' + userss.createTime[1]
  152. userss.createTime[2] >= 10 ? userss.createTime[2] : userss.createTime[1] = '0' + userss.createTime[2]
  153. userss.company.expirationDate[2] >= 10 ? userss.company.expirationDate[2] : userss.company.expirationDate[1] = '0' + userss.company.expirationDate[2]
  154. userss.company.expirationDate[1] >= 10 ? userss.company.expirationDate[1] : userss.company.expirationDate[1] = '0' + userss.company.expirationDate[1]
  155. this.expirationDate = userss.createTime[0] + '-' + userss.createTime[1] + '-' + userss.createTime[2] + ' 至 ' + userss.company.expirationDate[0] + '-' + userss.company.expirationDate[1] + '-' + userss.company.expirationDate[2]
  156. // 版本
  157. userss.company.packageOa = 1 ? this.version = '旗舰版' : ''
  158. userss.company.packageEngineering = 1 ? this.version = '建筑工程版' : ''
  159. userss.company.packageProject = 1 ? this.version = '专业版' : ''
  160. userss.company.packageWorktime = 1 ? this.version = '基础版' : ''
  161. }
  162. }
  163. };
  164. </script>
  165. <style lang="less" scoped>
  166. .myCenter {
  167. padding-bottom: 50px;
  168. }
  169. /* 本页公共样式 */
  170. .gray {
  171. color: #797d82;
  172. }
  173. .bott0 {
  174. bottom: 0;
  175. }
  176. .orange {
  177. color: #ff5f16
  178. }
  179. .yellow {
  180. color: #ffb232
  181. }
  182. .bd-gray {
  183. border-bottom: 1px solid #f5f5f5;
  184. }
  185. // 头部图片
  186. .beijin {
  187. background: url(../../../assets/img/personal/head_back.jpg) repeat-y center center;
  188. height: 200px;
  189. background-size: cover;
  190. margin-top: -44px;
  191. }
  192. // 用户名和头像
  193. .users {
  194. top: 55px;
  195. left: 22px;
  196. position: absolute;
  197. // 头像
  198. .imege {
  199. height: 65px;
  200. border-radius: 50%;
  201. }
  202. .fff {
  203. font-size: 22px;
  204. }
  205. }
  206. // 导航
  207. .nav {
  208. height: 75px;
  209. .iconfont {
  210. font-weight: bold;
  211. }
  212. .cit {
  213. height: 26px;
  214. }
  215. }
  216. .logout {
  217. width: 80%;
  218. margin: 50px auto;
  219. }
  220. // 主体
  221. main {
  222. .list {
  223. height: 50px;
  224. .image {
  225. height: 20px;
  226. }
  227. }
  228. .foun {
  229. font-size: 12px;
  230. }
  231. }
  232. /* 底部 */
  233. .footer {
  234. height: 50px;
  235. }
  236. // 扫码
  237. .scanCode {
  238. padding: 10px;
  239. }
  240. .scanCode_img img {
  241. width: 100%;
  242. }
  243. </style>