PersonalSetting.cshtml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340
  1. 
  2. @{
  3. ViewBag.Title = "PersonalSetting";
  4. Layout = "~/Views/MobileProblem/_APPMain.cshtml";
  5. }
  6. <script src="~/Content/Scripts/plugins/mui/js/mui.view.js"></script>
  7. <script src="https://cdn.staticfile.org/vue-resource/1.5.1/vue-resource.min.js"></script>
  8. <script src="~/Content/Scripts/babel.min.js"></script>
  9. <script src="~/Content/Scripts/polyfill.min.js"></script>
  10. <style>
  11. .mui-views,
  12. .mui-view,
  13. .mui-pages,
  14. .mui-page,
  15. .mui-page-content {
  16. position: absolute;
  17. left: 0;
  18. right: 0;
  19. top: 0;
  20. bottom: 0;
  21. width: 100%;
  22. height: 100%;
  23. background-color: #efeff4;
  24. }
  25. .mui-pages {
  26. top: 44px;
  27. height: auto;
  28. }
  29. .mui-scroll-wrapper,
  30. .mui-scroll {
  31. background-color: #efeff4;
  32. }
  33. .mui-page.mui-transitioning {
  34. -webkit-transition: -webkit-transform 300ms ease;
  35. transition: transform 300ms ease;
  36. }
  37. .mui-page-left {
  38. -webkit-transform: translate3d(0, 0, 0);
  39. transform: translate3d(0, 0, 0);
  40. }
  41. .mui-ios .mui-page-left {
  42. -webkit-transform: translate3d(-20%, 0, 0);
  43. transform: translate3d(-20%, 0, 0);
  44. }
  45. .mui-navbar {
  46. position: fixed;
  47. right: 0;
  48. left: 0;
  49. z-index: 10;
  50. height: 44px;
  51. background-color: #00aaff;
  52. }
  53. .mui-navbar .mui-bar {
  54. position: absolute;
  55. background: transparent;
  56. text-align: center;
  57. }
  58. .mui-android .mui-navbar-inner.mui-navbar-left {
  59. opacity: 0;
  60. }
  61. .mui-ios .mui-navbar-left .mui-left,
  62. .mui-ios .mui-navbar-left .mui-center,
  63. .mui-ios .mui-navbar-left .mui-right {
  64. opacity: 0;
  65. }
  66. .mui-navbar .mui-btn-nav {
  67. -webkit-transition: none;
  68. transition: none;
  69. -webkit-transition-duration: .0s;
  70. transition-duration: .0s;
  71. }
  72. .mui-navbar .mui-bar .mui-title {
  73. display: inline-block;
  74. width: auto;
  75. color: white;
  76. }
  77. .mui-page-shadow {
  78. position: absolute;
  79. right: 100%;
  80. top: 0;
  81. width: 16px;
  82. height: 100%;
  83. z-index: -1;
  84. content: '';
  85. }
  86. .mui-page-shadow {
  87. background: -webkit-linear-gradient(left, rgba(0, 0, 0, 0) 0, rgba(0, 0, 0, 0) 10%, rgba(0, 0, 0, .01) 50%, rgba(0, 0, 0, .2) 100%);
  88. background: linear-gradient(to right, rgba(0, 0, 0, 0) 0, rgba(0, 0, 0, 0) 10%, rgba(0, 0, 0, .01) 50%, rgba(0, 0, 0, .2) 100%);
  89. }
  90. .mui-navbar-inner.mui-transitioning,
  91. .mui-navbar-inner .mui-transitioning {
  92. -webkit-transition: opacity 300ms ease, -webkit-transform 300ms ease;
  93. transition: opacity 300ms ease, transform 300ms ease;
  94. }
  95. .mui-page {
  96. display: none;
  97. }
  98. .mui-pages .mui-page {
  99. display: block;
  100. }
  101. .mui-page .mui-table-view:first-child {
  102. margin-top: 15px;
  103. }
  104. .mui-page .mui-table-view:last-child {
  105. margin-bottom: 60px;
  106. }
  107. .mui-table-view {
  108. margin-top: 20px;
  109. }
  110. .mui-table-view span.mui-pull-right {
  111. color: #999;
  112. }
  113. .mui-table-view-divider {
  114. background-color: #efeff4;
  115. font-size: 14px;
  116. }
  117. .mui-table-view-divider:before,
  118. .mui-table-view-divider:after {
  119. height: 0;
  120. }
  121. .head {
  122. height: 40px;
  123. }
  124. #head {
  125. line-height: 40px;
  126. }
  127. .head-img {
  128. width: 40px;
  129. height: 40px;
  130. }
  131. #head-img1 {
  132. position: absolute;
  133. bottom: 10px;
  134. right: 40px;
  135. width: 40px;
  136. height: 40px;
  137. }
  138. .update {
  139. font-style: normal;
  140. color: #999999;
  141. margin-right: -25px;
  142. font-size: 15px;
  143. }
  144. .mui-fullscreen {
  145. position: fixed;
  146. z-index: 20;
  147. background-color: #000;
  148. }
  149. .mui-ios .mui-navbar .mui-bar .mui-title {
  150. position: static;
  151. }
  152. .mui-bar .mui-btn-nav.mui-pull-left {
  153. color: white;
  154. }
  155. .mui-btn-positive, .mui-btn-success, .mui-btn-green {
  156. color: #fff;
  157. border: 1px solid #00aaff;
  158. background-color: #00aaff;
  159. }
  160. </style>
  161. <div id="vue">
  162. <!--页面主结构开始-->
  163. <div id="app" class="mui-views">
  164. <div class="mui-view">
  165. <div class="mui-navbar">
  166. </div>
  167. <div class="mui-pages">
  168. </div>
  169. </div>
  170. </div>
  171. <div id="Main" class="mui-page">
  172. <!--页面标题栏开始-->
  173. <div class="mui-navbar-inner mui-bar mui-bar-nav">
  174. <button type="button" class="mui-left mui-action-back mui-btn mui-btn-link mui-btn-nav mui-pull-left">
  175. <span class="mui-icon mui-icon-left-nav"></span>
  176. </button>
  177. <h1 class="mui-center mui-title">个人设置</h1>
  178. </div>
  179. <!--页面标题栏结束-->
  180. <div class="mui-page-content">
  181. <ul class="mui-table-view mui-table-view-chevron">
  182. <li class="mui-table-view-cell">
  183. <a href="#UpdatePassword" class="mui-navigate-right"> 修改密码<i class="mui-pull-right update"></i></a>
  184. </li>
  185. </ul>
  186. </div>
  187. </div>
  188. <div id="UpdatePassword" class="mui-page">
  189. <!--页面标题栏开始-->
  190. <div class="mui-navbar-inner mui-bar mui-bar-nav">
  191. <button type="button" class="mui-left mui-action-back mui-btn mui-btn-link mui-btn-nav mui-pull-left">
  192. <span class="mui-icon mui-icon-left-nav"></span>
  193. </button>
  194. <h1 class="mui-center mui-title">修改密码</h1>
  195. </div>
  196. <!--页面标题栏结束-->
  197. <div class="mui-page-content">
  198. <form class="mui-input-group" style="margin-top:2rem">
  199. <div class="mui-input-row">
  200. <input v-model="Code" type="password" style="width:60%" class="mui-input" placeholder="请输入验证码">
  201. <button v-on:click="GetSMS" v-bind:disabled="SMS!='获取验证码'" type="button" class="mui-btn mui-btn-success" style="margin-top:5px;margin-right:5px;width:110px">{{SMS}}</button>
  202. </div>
  203. <div class="mui-input-row">
  204. <input v-model="password" type="password" class="mui-input-password" placeholder="请输入新密码">
  205. </div>
  206. <button type="button" style="margin-top: 10px;" class="mui-btn mui-btn-success mui-btn-block btn_2" v-on:click="ModifyPassword">提交</button>
  207. </form>
  208. </div>
  209. </div>
  210. </div>
  211. <script type="text/babel">
  212. var vm = new Vue({
  213. el: '#vue',
  214. data: {
  215. Code: '',
  216. SMS: '获取验证码',
  217. password: ''
  218. },
  219. created () {
  220. },
  221. mounted () {
  222. this.init();
  223. },
  224. methods: {
  225. ///初始化页面
  226. init: function () {
  227. var that = this;
  228. mui.init();
  229. var defaultPages = '#Main';
  230. //初始化单页view
  231. that.viewApi = mui('#app').view({
  232. defaultPage: defaultPages
  233. });
  234. mui('.mui-scroll-wrapper').scroll();
  235. //处理view的后退与webview后退
  236. var oldBack = mui.back;
  237. var view = that.viewApi.view;
  238. mui.back = function () {
  239. if (that.viewApi.canBack()) { //如果view可以后退,则执行view的后退
  240. that.viewApi.back();
  241. } else { //执行webview后退
  242. oldBack();
  243. }
  244. };
  245. },
  246. GetSMS () {
  247. var that = this;
  248. var validCode = true;
  249. var time = 60;
  250. if (validCode) {
  251. validCode = false;
  252. var t = setInterval(function () {
  253. time--;
  254. that.SMS = '重新获取(' + time + 's)';
  255. if (time == 0) {
  256. clearInterval(t);
  257. that.SMS = '获取验证码';
  258. validCode = true;
  259. }
  260. }, 1000);
  261. }
  262. $.post("/MobileProblem/GetSMSCodeCurrent", function (data) {
  263. if (data.code == "200") {
  264. mui.toast('短信发送成功', { duration: 'long', type: 'div' });
  265. } else {
  266. mui.toast('短信发送失败', { duration: 'long', type: 'div' });
  267. }
  268. }).error(function (xhr, type, errorThrown) {
  269. mui.toast('系统错误', { duration: 'long', type: 'div' });
  270. })
  271. },
  272. ModifyPassword() {
  273. var that = this;
  274. if (!this.password || !this.Code) {
  275. mui.toast('请填写完整信息', { duration: 'long', type: 'div' });
  276. return;
  277. }
  278. var t = mui.showLoading("修改中..", "div");
  279. $.post("/MobileProblem/PasswordModifySubmit", { "Code": that.Code, "password": that.password }, function (data) {
  280. mui.hideLoading(t);
  281. if (data.code == "200") {
  282. mui.toast('修改成功,正在跳转...', { duration: 'long', type: 'div' });
  283. mui.later(function () {
  284. window.location = "/MobileProblem/My";
  285. }, 1000)
  286. } else {
  287. mui.toast(data.msg, { duration: 'long', type: 'div' });
  288. }
  289. }).error(function (xhr, type, errorThrown) {
  290. mui.hideLoading(t);
  291. mui.toast('系统错误', { duration: 'long', type: 'div' });
  292. })
  293. }
  294. }
  295. })
  296. </script>