人民医院前端

setting.vue 8.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338
  1. <template>
  2. <page-meta :root-font-size="getFontSizeValue"></page-meta>
  3. <view class="content">
  4. <view class="userInfo" @click="infoHandle">
  5. <view class="userInfoLeft">
  6. <image src="/static/person.png" mode=""></image>
  7. </view>
  8. <view class="userInfoRight">
  9. <view>{{userName}}--{{userCode}}</view>
  10. <view>{{deptName}}</view>
  11. </view>
  12. </view>
  13. <view class="userList">
  14. <view class="listCell" v-for="(item,index) in listCell" :key="index">
  15. <image :src="item.imgPath"></image>
  16. <text>{{item.itemText}}</text>
  17. <uni-icons class="fontIcon" type="arrowright" color="#d6d6d4" size="18"></uni-icons>
  18. </view>
  19. <view class="listCell" @click="trunFontSizeSetting">
  20. <image src="/static/Wd.png"></image>
  21. <text>设置字体大小</text>
  22. <text class="versionNum">{{fontSizeString}}</text>
  23. </view>
  24. <view class="listCell" @touchend="touchHandle">
  25. <image src="/static/Wd.png"></image>
  26. <text>版本</text>
  27. <text class="versionNum">{{version}}</text>
  28. </view>
  29. <view class="listCell" @touchend="btnChange" v-if="isAllowDept==1">
  30. <image src="/static/Wd.png"></image>
  31. <text>切换科室</text>
  32. <text class="versionNum">{{deptName}}</text>
  33. </view>
  34. </view>
  35. <!-- <view class="btnExit" v-if="isAllowDept==1">
  36. <button type="primary" @click="btnChange">切换科室</button>
  37. </view> -->
  38. <view class="btnExit">
  39. <button type="primary" @click="btnExit">退出登录</button>
  40. </view>
  41. <view>
  42. <uni-popup ref="inputDialogs" type="dialog">
  43. <uni-popup-dialog ref="inputClose" mode="input" :title="title" @confirm="dialogInputConfirm">
  44. <view>
  45. <uni-table style="height: 600rpx;" ref="table" border stripe emptyText="暂无更多数据">
  46. <uni-tr>
  47. <uni-th align="center">请选择</uni-th>
  48. </uni-tr>
  49. <uni-tr>
  50. <uni-td align="center">
  51. <radio-group @change="radioChange" style="width: 100%;">
  52. <label class="uni-list-cell uni-list-cell-pd" v-for="(item, index) in allowData"
  53. :key="index">
  54. <view style="padding: 5px 0;position: relative;width: 100%;">
  55. <radio style="width: 30px;position: absolute;left: 0;"
  56. :value="item.deptid" :checked="index === current" />
  57. <text style="margin-left: 15px;display: inline-block;width: 80%;">{{ $mHelper.findParents(departList, item.deptid) }}</text>
  58. </view>
  59. </label>
  60. </radio-group>
  61. </uni-td>
  62. </uni-tr>
  63. </uni-table>
  64. </view>
  65. </uni-popup-dialog>
  66. </uni-popup>
  67. </view>
  68. </view>
  69. </template>
  70. <script>
  71. import { debuggerModule, installDebugger } from 'uni_modules/imengyu-IMDebuggerWindow/common/debuggerExtern.js'
  72. import {
  73. mapGetters
  74. } from 'vuex';
  75. import store from '@/store';
  76. export default {
  77. data() {
  78. return {
  79. isAllowDept:0,
  80. current:"",
  81. onchangedept:"",
  82. selectedIndexs:[],
  83. departList:[],
  84. allowData:[],
  85. title:'允用科室',
  86. getFontSizeValue:'1rem',
  87. version: '1.1.8',
  88. fontSizeString:'',
  89. touchHandleTime:0,
  90. listCell: [
  91. // {
  92. // imgPath:'../../static/Wa.png',
  93. // itemText:'服务守则'
  94. // },
  95. ]
  96. }
  97. },
  98. onLoad() {
  99. if(uni.getStorageSync('storageAllowUserDept').indexOf(",")>=0){
  100. this.isAllowDept = 1
  101. }
  102. this.departList = JSON.parse(uni.getStorageSync("deptTreeData"));
  103. this.getFontSizeValue = uni.getStorageSync('fontSizeValue')+'rem'
  104. if(uni.getStorageSync('fontSizeValue') === 1){
  105. this.fontSizeString = '小'
  106. }else if (uni.getStorageSync('fontSizeValue') === 1.2){
  107. this.fontSizeString = '中'
  108. }else if (uni.getStorageSync('fontSizeValue') === 1.4){
  109. this.fontSizeString = '大'
  110. }
  111. store.dispatch("GetInfo")
  112. // 页面
  113. this.updateList()
  114. // #ifdef APP-PLUS
  115. this.version = 'v' + plus.runtime.version
  116. // #endif
  117. },
  118. methods: {
  119. radioChange: function(evt) {
  120. this.onchangedept = evt.detail.value;
  121. console.log(evt.detail.value)
  122. for (let i = 0; i < this.allowData.length; i++) {
  123. if (this.allowData[i].deptid === evt.detail.value) {
  124. this.current = i;
  125. break;
  126. }
  127. }
  128. },
  129. selectionChange(e){
  130. this.selectedIndexs = e.detail.index
  131. this.onchangedept = this.allowData[e.detail.index].deptid
  132. console.log(this.allowData[e.detail.index])
  133. },
  134. dialogInputConfirm(){
  135. // if(this.selectedIndexs.length!=1){
  136. // this.$mHelper.toast("请选择一行数据");
  137. // return;
  138. // }
  139. const params={
  140. deptId:this.onchangedept||this.deptId,
  141. userid:uni.getStorageSync('userId')
  142. }
  143. this.$http.get('UserAccount/ChangeDeptId', params).then(res=>{
  144. if(res.state == "success"){
  145. this.$mHelper.toast(res.message);
  146. this.$refs.inputDialogs.close()
  147. this.$mStore.dispatch("GetInfo").then((e)=>{
  148. if(e.data.Dept){
  149. uni.setStorageSync('deptId', e.data.Dept.F_DeptId)
  150. uni.setStorageSync('deptName', e.data.Dept.F_DeptName)
  151. }
  152. })
  153. }
  154. })
  155. },
  156. updateList(){
  157. uni.$on("updateList", (res) => {
  158. store.dispatch("GetInfo")
  159. })
  160. },
  161. trunFontSizeSetting(){
  162. uni.navigateTo({
  163. url: "/pages/setting/fontSizeSetting/fontSizeSetting"
  164. })
  165. },
  166. touchHandle(e) {
  167. this.touchHandleTime++
  168. console.log(this.touchHandleTime)
  169. if(this.touchHandleTime === 5){
  170. this.touchHandleTime = 0
  171. installDebugger({
  172. enableRequestInterceptor: true, //默认为false,指示是否拦截网络请求,参见下一条
  173. showGlobalFloatWindow: true //默认为true,指定是否添加一个全局的调试按钮,点击可跳转至窗口
  174. });
  175. }
  176. },
  177. btnChange(){
  178. var str = uni.getStorageSync('storageAllowUserDept')//获取允用科室ids
  179. var arr = []
  180. if (str.indexOf(',') >= 0) {
  181. for (var i = 0; i < str.split(",").length; i++) {
  182. arr.push({
  183. deptname: '',
  184. deptid: str.split(",")[i]
  185. })
  186. if(this.deptId == str.split(",")[i]){
  187. this.current = i;
  188. }
  189. }
  190. this.allowData = arr
  191. console.log(arr)
  192. }
  193. this.$refs.inputDialogs.open()
  194. },
  195. btnExit() {
  196. uni.showModal({
  197. title: '确定退出吗?',
  198. content: '退出到登录页面',
  199. success: function(res) {
  200. if (res.confirm) {
  201. uni.setStorageSync('Username', '');
  202. uni.setStorageSync('Password', '');
  203. uni.setStorageSync('token', '');
  204. uni.reLaunch({
  205. url: '/pages/login/login'
  206. });
  207. } else if (res.cancel) {
  208. console.log('用户点击取消');
  209. }
  210. }
  211. });
  212. },
  213. infoHandle(){
  214. uni.navigateTo({
  215. url:"personDetail/personDetail?userCode="+this.userCode
  216. })
  217. }
  218. },
  219. computed: {
  220. ...mapGetters([
  221. "userCode", // 用户工号
  222. "userName", // 用户名称
  223. "deptId",
  224. "deptName", // 部门名称
  225. ])
  226. }
  227. }
  228. </script>
  229. <style lang="scss">
  230. .equipmentInfo {
  231. width: 100%;
  232. margin-top: 15px;
  233. border: 1px solid rgb(229, 229, 229);
  234. box-shadow: 0px 4px 16px 0px rgba(69, 91, 99, 0.05);
  235. margin-bottom: 20px;
  236. border-radius: 5px;
  237. .trCon {
  238. width: 100%;
  239. // font-size: 14px;
  240. .tdCon {
  241. display: inline-block;
  242. padding: 10px 0px;
  243. color: rgb(102, 102, 102);
  244. width: 48%;
  245. padding-right: 5px;
  246. text-align: center;
  247. }
  248. }
  249. }
  250. .userInfo {
  251. // background: url(/static/setting_banner.png) no-repeat;
  252. background-color: rgb(0, 122, 255);
  253. background-size: 100% 100%;
  254. width: 100%;
  255. height: 260rpx;
  256. display: flex;
  257. .userInfoLeft {
  258. width: 150rpx;
  259. height: 150rpx;
  260. border-radius: 75rpx;
  261. margin: 30rpx 30rpx 0rpx 30rpx;
  262. background: #FFFFFF;
  263. image {
  264. width: 100%;
  265. height: 100%;
  266. padding: 30rpx 20rpx 30rpx 35rpx;
  267. box-sizing: border-box;
  268. }
  269. }
  270. .userInfoRight {
  271. margin-top: 50rpx;
  272. view {
  273. color: #FFFFFF;
  274. }
  275. }
  276. }
  277. .userList {
  278. width: 100%;
  279. border-top: 1rpx solid #d6d6d4;
  280. border-bottom: 1rpx solid #d6d6d4;
  281. background: #FFFFFF;
  282. margin-top: 40rpx;
  283. overflow: hidden;
  284. .listCell {
  285. width: 720rpx;
  286. margin-left: 30rpx;
  287. height: 84rpx;
  288. line-height: 84rpx;
  289. border-bottom: 1rpx solid #d6d6d4;
  290. position: relative;
  291. display: flex;
  292. image {
  293. width: 40rpx;
  294. height: 40rpx;
  295. margin: 22rpx 22rpx 0 22rpx;
  296. box-sizing: border-box;
  297. }
  298. .fontIcon {
  299. position: absolute;
  300. right: 40rpx;
  301. }
  302. .versionNum {
  303. position: absolute;
  304. right: 80rpx;
  305. color: #999998;
  306. }
  307. }
  308. .listCell:last-child {
  309. border: none;
  310. }
  311. }
  312. .btnExit {
  313. width: 80%;
  314. margin: 30rpx auto;
  315. }
  316. </style>