setting.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384
  1. <template>
  2. <view>
  3. <ujp-navbar title="设置"></ujp-navbar> <view class="group">
  4. <view class="userCell-item">
  5. <view class="userCell-title">
  6. <p class="oldTextjp" oldstyle="font-size: 18px;">长辈模式</p>
  7. </view>
  8. <view class="userCell-content " >
  9. <view class="value">
  10. <view class="text oldTextjp2" oldstyle="font-size: 16px;">
  11. 字体更大 看得清
  12. </view>
  13. <u-switch v-model="checked" active-color="#00E266" @change="checkedChange"></u-switch>
  14. </view>
  15. </view>
  16. </view>
  17. <view class="userCell-item" v-if="personInfo.memberLevel==3||personInfo.memberLevel==4">
  18. <view class="userCell-title">
  19. <p class="oldTextjp" oldstyle="font-size: 18px;">快捷充电</p>
  20. </view>
  21. <view class="userCell-content " >
  22. <view class="value">
  23. <view class="text oldTextjp2" oldstyle="font-size: 16px;" @click="quickChargingBl=true">
  24. 扫码即充 充满自停<u-icon name="question-circle"></u-icon>
  25. </view>
  26. <u-switch v-model="checked2" active-color="#00E266" @change="checkedChange2"></u-switch>
  27. </view>
  28. </view>
  29. </view>
  30. <view class="userCell-item" @click="gotoUrl('pages/user/logout')">
  31. <view class="userCell-title">
  32. <p class="oldTextjp" oldstyle="font-size: 18px;">注销账号</p>
  33. </view>
  34. <view class="userCell-content " >
  35. <text class="ff oldTextjp2" oldstyle="font-size: 16px;">注销后无法恢复,请谨慎操作 </text>
  36. <text class="iconfont">&#xe600;</text>
  37. </view>
  38. </view>
  39. </view>
  40. <view class="logout-btn oldTextjp" oldstyle="font-size:18px" @click="signOut">
  41. 退出帐号
  42. </view>
  43. <view>
  44. <u-modal v-model="show" @confirm="confirm" confirm-color="#FF3D00" :show-cancel-button="true" ref="uModal" :asyncClose="true" :title="title"
  45. :content="content" :content-style="{color: '#333333'}"></u-modal>
  46. </view>
  47. <u-modal v-model="quickChargingBl" :mask-close-able="true" class="quickMain" confirm-text="注册会员" cancel-text="先不注册" :show-title="false" width="650"
  48. border-radius="30" title="" :show-cancel-button="false" :show-confirm-button="false">
  49. <view class="quickMain-slot-content">
  50. <!-- :show-title="false" -->
  51. <view class="quickMain-img">
  52. <img src="@/assets/img/member/10.png" ></img>
  53. </view>
  54. <view class="quickMain-bodyMain" >
  55. <view class="quickMain-body">
  56. <view class="quickMain-text1">快捷充电功能上线!</view>
  57. <view class="quickMain-text2">
  58. 恭喜您达到
  59. <img src="@/assets/img/9-4/白金会员.svg" ></img>
  60. <span style="color:#3F51B5;">白金会员</span>等级,您已获得<span style="color: #19be6b;">【快捷充电】</span>功能体验资格。
  61. </view>
  62. <view class="quickMain-text2">
  63. 当您插枪扫码后,在个人账户余额充足的情况下,自动帮您选择充满自停模式并开始充电。如需关闭此功能,可在“我的”-“设置”中修改。
  64. </view>
  65. </view>
  66. <view class="btnview">
  67. <view class="btnview2" @click="quickChargingBl=false">关闭弹窗</view>
  68. </view>
  69. </view>
  70. </view>
  71. </u-modal>
  72. </view>
  73. </template>
  74. <script>
  75. import * as userApi from '@/apis/user.js'
  76. import * as API from '@/apis/index.js'
  77. import * as loginApi from '@/apis/login.js'
  78. export default {
  79. data() {
  80. return {
  81. show: false,
  82. title: '退出账号',
  83. content: '是否退出当前账号?',
  84. userId: '',
  85. userPhone: '',
  86. quickChargingBl:false,
  87. checked:false,
  88. checked2:false,
  89. valueStyle: {
  90. color:'#ff3300',
  91. },
  92. valueStyle2: {
  93. color: '#777777',
  94. textAlign: 'left',
  95. marginLeft: '8px'
  96. },
  97. titleStyle: {
  98. fontWeight: 'bold',
  99. fontSize: '18px',
  100. },
  101. fontMode: '',
  102. personInfo:{}
  103. }
  104. },
  105. onReady() {
  106. if(this.carhelp.get("getElderModeClass") == "长辈模式") {
  107. this.checked = true;
  108. } else {
  109. this.checked = false;
  110. }
  111. this.personInfo = this.carhelp.getPersonInfo()
  112. this.$forceUpdate()
  113. if(this.personInfo.fontMode=="1"){
  114. this.checked = true;
  115. this.carhelp.set("getElderModeClass","长辈模式")
  116. }
  117. if(this.personInfo.quickCharging){
  118. this.checked2 = true;
  119. }
  120. },
  121. methods: {
  122. getUserInfo() {
  123. uni.showLoading({
  124. title: "加载中",
  125. mask: true,
  126. })
  127. loginApi.findByOpenId({
  128. openId: this.carhelp.getOpenId()
  129. }).then((res) => {
  130. uni.hideLoading();
  131. if (res.code == 200&&res.result) {
  132. var token = res ? res.data.token : '';
  133. this.personInfo=res.data.regUser
  134. this.carhelp.setPersonInfo(res.data.regUser );
  135. this.carhelp.setToken(token);
  136. this.carhelp.setPersonInfoPlus(res.data);
  137. console.log("setPersonInfoPlus")
  138. }
  139. }).catch(error => {
  140. this.carhelp.logoff()
  141. uni.showToast({
  142. title: error,
  143. icon: "none"
  144. })
  145. })
  146. },
  147. checkedChange2() {
  148. API.changeQuickCharging({qucikStatus: this.checked2?1:0}).then((res) => {
  149. this.getUserInfo()
  150. }).catch(error => {
  151. uni.showToast({
  152. title: error,
  153. icon: "none"
  154. })
  155. })
  156. },
  157. checkedChange() {
  158. if(this.checked) {
  159. this.carhelp.set("getElderModeClass", "长辈模式");
  160. this.fontMode = '1';
  161. } else {
  162. this.carhelp.set("getElderModeClass", "标准模式");
  163. this.fontMode = '0';
  164. }
  165. API.changeFont({fontMode: this.fontMode}).then((res) => {
  166. this.getUserInfo()
  167. }).catch(error => {
  168. uni.showToast({
  169. title: error,
  170. icon: "none"
  171. })
  172. })
  173. },
  174. signOut() {
  175. this.show = true;
  176. },
  177. confirm() {
  178. uni.showLoading({
  179. title: "加载中",
  180. mask: true,
  181. })
  182. userApi.logout().then((res) => {
  183. uni.hideLoading();
  184. this.show = false;
  185. this.carhelp.logoff()
  186. uni.redirectTo({
  187. url: '/pages/login/login'
  188. })
  189. }).catch(error => {
  190. uni.showToast({
  191. title: error,
  192. icon: "none"
  193. })
  194. })
  195. }
  196. }
  197. }
  198. </script>
  199. <style lang="scss" scoped>
  200. .quickMain{
  201. ::v-deep.u-mode-center-box{
  202. background-color: transparent;
  203. }
  204. ::v-deep.u-model{
  205. background-color: transparent;
  206. }
  207. .quickMain-slot-content{
  208. .quickMain-img{
  209. position: relative;
  210. top: 120rpx;
  211. text-align: center;
  212. img{
  213. width: 160rpx;
  214. height: 240rpx;
  215. }
  216. }
  217. .quickMain-bodyMain{
  218. background-color:#fff;
  219. border-radius: 15px;
  220. padding-bottom:20rpx;
  221. }
  222. .quickMain-body{
  223. margin:0 56rpx ;
  224. color: rgba(51, 51, 51, 1);
  225. .quickMain-text1{
  226. font-size: 48rpx;
  227. text-align: center;
  228. padding: 132rpx 0 32rpx 0;
  229. }
  230. .quickMain-text2{
  231. margin-bottom: 20rpx ;
  232. //color: rgba(51, 51, 51, 1);
  233. font-size: 32rpx;
  234. img{
  235. width: 40rpx;
  236. //height: 120px;
  237. }
  238. }
  239. }
  240. }
  241. }
  242. .logout-btn{
  243. background-color: #fff;
  244. padding: 12px 0;
  245. text-align: center;
  246. margin-top: 12px;
  247. }
  248. .group{
  249. background-color: #fff;
  250. margin-top: 12px;
  251. }
  252. .ff{
  253. color: #FF0000;
  254. }
  255. .userCell-item {
  256. display: flex;
  257. border-bottom: 1px solid rgba(241, 241, 241, 100);
  258. align-items: center;
  259. padding: 8px 16px 8px 0px;
  260. margin-left: 8px;
  261. .userCell-title {
  262. font-size: 16px;
  263. display: flex;
  264. margin-right: 8px;
  265. p {
  266. margin-left: 8px;
  267. font-size: 16px;
  268. line-height: 28px;
  269. color: #1a1a1a;
  270. }
  271. }
  272. .userCell-content {
  273. display: flex;
  274. flex: 1;
  275. justify-content: space-between;
  276. //margin-left: 20rpx;
  277. color: #777777;
  278. font-size: 12px;
  279. line-height: 20px;
  280. .iconfont{
  281. font-size: 24px;
  282. margin: auto 0;
  283. color: #b3b3b3
  284. }
  285. }
  286. .value {
  287. display: flex;
  288. justify-content: space-between;
  289. flex: 1;
  290. .text {
  291. line-height: 28px;
  292. // margin-right: 20vw;
  293. }
  294. }
  295. .u-switch {
  296. float: right;
  297. width: 48px;
  298. height: 24px;
  299. vertical-align: middle;
  300. margin-left: 8px;
  301. }
  302. ::v-deep.u-switch__node {
  303. width: 24px !important;
  304. height: 24px !important;
  305. }
  306. }
  307. .switcher-mode{
  308. background-color: #fff;
  309. height: 44px;
  310. line-height: 44px;
  311. display: flex;
  312. justify-content: space-between;
  313. padding: 0 14px;
  314. text{
  315. font-size: 12px;
  316. color: rgba(119, 119, 119, 100);
  317. margin-left: 8px;
  318. }
  319. .switch-box{
  320. padding-top: 8px;
  321. }
  322. .switch{
  323. width: 40px;
  324. height: 22px;
  325. }
  326. ::v-deep.u-switch__node{
  327. width: 20px !important;
  328. height: 20px !important;
  329. }
  330. }
  331. .btnview {
  332. display: flex;
  333. flex-direction: column;
  334. align-items: center;
  335. .btnview1 {}
  336. .btnview2 {
  337. color: #999999;
  338. margin-top: 20rpx;
  339. padding-bottom: 48rpx;
  340. }
  341. }
  342. </style>