人民医院前端

setting.vue 9.9KB

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