人民医院前端

setting.vue 9.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374
  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. console.log(str,'hhh',this.deptId)
  199. var arr = []
  200. if (str.indexOf(',') >= 0) {
  201. for (var i = 0; i < str.split(",").length; i++) {
  202. if(this.deptId == str.split(",")[i]){
  203. this.current = 0;
  204. arr.unshift({
  205. deptname: '',
  206. deptid: str.split(",")[i]
  207. })
  208. }else{
  209. arr.push({
  210. deptname: '',
  211. deptid: str.split(",")[i]
  212. })
  213. }
  214. }
  215. this.allowData = arr
  216. }
  217. this.$refs.inputDialogs.open()
  218. },
  219. btnExit() {
  220. uni.showModal({
  221. title: '确定退出吗?',
  222. content: '退出到登录页面',
  223. success: function(res) {
  224. if (res.confirm) {
  225. uni.setStorageSync('Username', '');
  226. uni.setStorageSync('Password', '');
  227. uni.setStorageSync('token', '');
  228. uni.reLaunch({
  229. url: '/pages/login/login'
  230. });
  231. } else if (res.cancel) {
  232. console.log('用户点击取消');
  233. }
  234. }
  235. });
  236. },
  237. infoHandle(){
  238. uni.navigateTo({
  239. url:"personDetail/personDetail?userCode="+this.userCode
  240. })
  241. }
  242. },
  243. computed: {
  244. ...mapGetters([
  245. "userCode", // 用户工号
  246. "userName", // 用户名称
  247. "deptId",
  248. "deptName", // 部门名称
  249. ])
  250. }
  251. }
  252. </script>
  253. <style lang="scss">
  254. /deep/.uni-dialog-content{
  255. margin: 0;
  256. padding: 0;
  257. }
  258. .yydepttit {
  259. display: inline-block;
  260. width: 85%;
  261. text-align: center;
  262. font-size: 14px;
  263. vertical-align: middle;
  264. // height: 24px;
  265. }
  266. .equipmentInfo {
  267. width: 100%;
  268. margin-top: 15px;
  269. border: 1px solid rgb(229, 229, 229);
  270. box-shadow: 0px 4px 16px 0px rgba(69, 91, 99, 0.05);
  271. margin-bottom: 20px;
  272. border-radius: 5px;
  273. .trCon {
  274. width: 100%;
  275. // font-size: 14px;
  276. .tdCon {
  277. display: inline-block;
  278. padding: 10px 0px;
  279. color: rgb(102, 102, 102);
  280. width: 48%;
  281. padding-right: 5px;
  282. text-align: center;
  283. }
  284. }
  285. }
  286. .userInfo {
  287. // background: url(/static/setting_banner.png) no-repeat;
  288. background-color: rgb(0, 122, 255);
  289. background-size: 100% 100%;
  290. width: 100%;
  291. height: 260rpx;
  292. display: flex;
  293. .userInfoLeft {
  294. width: 150rpx;
  295. height: 150rpx;
  296. border-radius: 75rpx;
  297. margin: 30rpx 30rpx 0rpx 30rpx;
  298. background: #FFFFFF;
  299. image {
  300. width: 100%;
  301. height: 100%;
  302. padding: 30rpx 20rpx 30rpx 35rpx;
  303. box-sizing: border-box;
  304. }
  305. }
  306. .userInfoRight {
  307. margin-top: 50rpx;
  308. view {
  309. color: #FFFFFF;
  310. }
  311. }
  312. }
  313. .userList {
  314. width: 100%;
  315. border-top: 1rpx solid #d6d6d4;
  316. border-bottom: 1rpx solid #d6d6d4;
  317. background: #FFFFFF;
  318. margin-top: 40rpx;
  319. overflow: hidden;
  320. .listCell {
  321. width: 720rpx;
  322. margin-left: 30rpx;
  323. height: 84rpx;
  324. line-height: 84rpx;
  325. border-bottom: 1rpx solid #d6d6d4;
  326. position: relative;
  327. display: flex;
  328. image {
  329. width: 40rpx;
  330. height: 40rpx;
  331. margin: 22rpx 22rpx 0 22rpx;
  332. box-sizing: border-box;
  333. }
  334. .fontIcon {
  335. position: absolute;
  336. right: 40rpx;
  337. }
  338. .versionNum {
  339. position: absolute;
  340. right: 80rpx;
  341. color: #999998;
  342. }
  343. }
  344. .listCell:last-child {
  345. border: none;
  346. }
  347. }
  348. .btnExit {
  349. width: 80%;
  350. margin: 30rpx auto;
  351. }
  352. </style>