人民医院前端

setting.vue 9.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368
  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. export default {
  91. data() {
  92. return {
  93. isAllowDept:0,
  94. current:"",
  95. onchangedept:"",
  96. selectedIndexs:[],
  97. departList:[],
  98. allowData:[],
  99. title:'允用科室',
  100. getFontSizeValue:'1rem',
  101. version: '1.1.8',
  102. fontSizeString:'',
  103. touchHandleTime:0,
  104. listCell: [
  105. // {
  106. // imgPath:'../../static/Wa.png',
  107. // itemText:'服务守则'
  108. // },
  109. ]
  110. }
  111. },
  112. onLoad() {
  113. if(uni.getStorageSync('storageAllowUserDept').indexOf(",")>=0){
  114. this.isAllowDept = 1
  115. }
  116. this.departList = JSON.parse(uni.getStorageSync("deptTreeData"));
  117. this.getFontSizeValue = uni.getStorageSync('fontSizeValue')+'rem'
  118. if(uni.getStorageSync('fontSizeValue') === 1){
  119. this.fontSizeString = '小'
  120. }else if (uni.getStorageSync('fontSizeValue') === 1.2){
  121. this.fontSizeString = '中'
  122. }else if (uni.getStorageSync('fontSizeValue') === 1.4){
  123. this.fontSizeString = '大'
  124. }
  125. store.dispatch("GetInfo")
  126. // 页面
  127. this.updateList()
  128. // #ifdef APP-PLUS
  129. this.version = 'v' + plus.runtime.version
  130. // #endif
  131. },
  132. methods: {
  133. radioChange: function(evt) {
  134. this.onchangedept = evt.detail.value;
  135. console.log(evt.detail.value)
  136. for (let i = 0; i < this.allowData.length; i++) {
  137. if (this.allowData[i].deptid === evt.detail.value) {
  138. this.current = i;
  139. break;
  140. }
  141. }
  142. },
  143. selectionChange(e){
  144. this.selectedIndexs = e.detail.index
  145. this.onchangedept = this.allowData[e.detail.index].deptid
  146. console.log(this.allowData[e.detail.index])
  147. },
  148. dialogInputConfirm(){
  149. // if(this.selectedIndexs.length!=1){
  150. // this.$mHelper.toast("请选择一行数据");
  151. // return;
  152. // }
  153. const params={
  154. deptId:this.onchangedept||this.deptId,
  155. userid:uni.getStorageSync('userId')
  156. }
  157. this.$http.get('UserAccount/ChangeDeptId', params).then(res=>{
  158. if(res.state == "success"){
  159. this.$mHelper.toast(res.message);
  160. this.$refs.inputDialogs.close()
  161. this.$mStore.dispatch("GetInfo").then((e)=>{
  162. if(e.data.Dept){
  163. uni.setStorageSync('deptId', e.data.Dept.F_DeptId)
  164. uni.setStorageSync('deptName', e.data.Dept.F_DeptName)
  165. }
  166. })
  167. }
  168. })
  169. },
  170. updateList(){
  171. uni.$on("updateList", (res) => {
  172. store.dispatch("GetInfo")
  173. })
  174. },
  175. trunFontSizeSetting(){
  176. uni.navigateTo({
  177. url: "/pages/setting/fontSizeSetting/fontSizeSetting"
  178. })
  179. },
  180. trunFontSizeSettingPass(){
  181. uni.navigateTo({
  182. url: "/pages/setting/fontSizeSettingPass/fontSizeSettingPass"
  183. })
  184. },
  185. touchHandle(e) {
  186. this.touchHandleTime++
  187. console.log(this.touchHandleTime)
  188. if(this.touchHandleTime === 5){
  189. this.touchHandleTime = 0
  190. installDebugger({
  191. enableRequestInterceptor: true, //默认为false,指示是否拦截网络请求,参见下一条
  192. showGlobalFloatWindow: true //默认为true,指定是否添加一个全局的调试按钮,点击可跳转至窗口
  193. });
  194. }
  195. },
  196. btnChange(){
  197. var str = uni.getStorageSync('storageAllowUserDept')//获取允用科室ids
  198. var arr = []
  199. if (str.indexOf(',') >= 0) {
  200. for (var i = 0; i < str.split(",").length; i++) {
  201. arr.push({
  202. deptname: '',
  203. deptid: str.split(",")[i]
  204. })
  205. if(this.deptId == str.split(",")[i]){
  206. this.current = i;
  207. }
  208. }
  209. this.allowData = arr
  210. }
  211. this.$refs.inputDialogs.open()
  212. },
  213. btnExit() {
  214. uni.showModal({
  215. title: '确定退出吗?',
  216. content: '退出到登录页面',
  217. success: function(res) {
  218. if (res.confirm) {
  219. uni.setStorageSync('Username', '');
  220. uni.setStorageSync('Password', '');
  221. uni.setStorageSync('token', '');
  222. uni.reLaunch({
  223. url: '/pages/login/login'
  224. });
  225. } else if (res.cancel) {
  226. console.log('用户点击取消');
  227. }
  228. }
  229. });
  230. },
  231. infoHandle(){
  232. uni.navigateTo({
  233. url:"personDetail/personDetail?userCode="+this.userCode
  234. })
  235. }
  236. },
  237. computed: {
  238. ...mapGetters([
  239. "userCode", // 用户工号
  240. "userName", // 用户名称
  241. "deptId",
  242. "deptName", // 部门名称
  243. ])
  244. }
  245. }
  246. </script>
  247. <style lang="scss">
  248. /deep/.uni-dialog-content{
  249. margin: 0;
  250. padding: 0;
  251. }
  252. .yydepttit {
  253. display: inline-block;
  254. width: 85%;
  255. text-align: center;
  256. font-size: 14px;
  257. vertical-align: middle;
  258. // height: 24px;
  259. }
  260. .equipmentInfo {
  261. width: 100%;
  262. margin-top: 15px;
  263. border: 1px solid rgb(229, 229, 229);
  264. box-shadow: 0px 4px 16px 0px rgba(69, 91, 99, 0.05);
  265. margin-bottom: 20px;
  266. border-radius: 5px;
  267. .trCon {
  268. width: 100%;
  269. // font-size: 14px;
  270. .tdCon {
  271. display: inline-block;
  272. padding: 10px 0px;
  273. color: rgb(102, 102, 102);
  274. width: 48%;
  275. padding-right: 5px;
  276. text-align: center;
  277. }
  278. }
  279. }
  280. .userInfo {
  281. // background: url(/static/setting_banner.png) no-repeat;
  282. background-color: rgb(0, 122, 255);
  283. background-size: 100% 100%;
  284. width: 100%;
  285. height: 260rpx;
  286. display: flex;
  287. .userInfoLeft {
  288. width: 150rpx;
  289. height: 150rpx;
  290. border-radius: 75rpx;
  291. margin: 30rpx 30rpx 0rpx 30rpx;
  292. background: #FFFFFF;
  293. image {
  294. width: 100%;
  295. height: 100%;
  296. padding: 30rpx 20rpx 30rpx 35rpx;
  297. box-sizing: border-box;
  298. }
  299. }
  300. .userInfoRight {
  301. margin-top: 50rpx;
  302. view {
  303. color: #FFFFFF;
  304. }
  305. }
  306. }
  307. .userList {
  308. width: 100%;
  309. border-top: 1rpx solid #d6d6d4;
  310. border-bottom: 1rpx solid #d6d6d4;
  311. background: #FFFFFF;
  312. margin-top: 40rpx;
  313. overflow: hidden;
  314. .listCell {
  315. width: 720rpx;
  316. margin-left: 30rpx;
  317. height: 84rpx;
  318. line-height: 84rpx;
  319. border-bottom: 1rpx solid #d6d6d4;
  320. position: relative;
  321. display: flex;
  322. image {
  323. width: 40rpx;
  324. height: 40rpx;
  325. margin: 22rpx 22rpx 0 22rpx;
  326. box-sizing: border-box;
  327. }
  328. .fontIcon {
  329. position: absolute;
  330. right: 40rpx;
  331. }
  332. .versionNum {
  333. position: absolute;
  334. right: 80rpx;
  335. color: #999998;
  336. }
  337. }
  338. .listCell:last-child {
  339. border: none;
  340. }
  341. }
  342. .btnExit {
  343. width: 80%;
  344. margin: 30rpx auto;
  345. }
  346. </style>