AI营销辅助 普强使用
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 

105 rader
2.1 KiB

  1. <template>
  2. <view class="bocx">
  3. <view class="box-che">
  4. <input class="box-input" v-model="name" placeholder-class="inpTextBox" type="text" placeholder="请输入" maxlength="5" />
  5. </view>
  6. <view class="nic">请输入昵称 (不超过5个字)</view>
  7. <view class="cev" @tap="saveName">保存</view>
  8. </view>
  9. </template>
  10. <script>
  11. var app = getApp();
  12. var util = require("../../utils/util.js");
  13. var config = require("../../config");
  14. export default {
  15. data() {
  16. return {
  17. name: "",
  18. };
  19. },
  20. onLoad: function(options) {
  21. var userInfos = uni.getStorageSync('weapp_session_userInfo_data');
  22. this.name=userInfos.name;
  23. },
  24. methods: {
  25. // 保存昵称
  26. saveName() {
  27. //获取本地用户信息
  28. var userInfos = uni.getStorageSync('weapp_session_userInfo_data');
  29. if (this.name == "") {
  30. uni.showModal({
  31. title: '提示',
  32. content: '昵称不能为空',
  33. showCancel: false
  34. });
  35. } else {
  36. util.getRequestPromise(config.service.upload, {
  37. name: this.name
  38. }).then(data => {
  39. userInfos.name = this.name;
  40. uni.setStorageSync('weapp_session_userInfo_data', userInfos); //写入缓存
  41. uni.navigateBack({
  42. delta: 1
  43. });
  44. });
  45. }
  46. }
  47. }
  48. };
  49. </script>
  50. <style>
  51. .bocx{
  52. width: 100%;
  53. height: 100vh;
  54. background-color: #F8F8F8;
  55. }
  56. .box-che{
  57. width: 100%;
  58. height: 102rpx;
  59. background: #FFFFFF;
  60. margin-top: 20rpx;
  61. }
  62. .box-input{
  63. width: 90%;
  64. height: 100%;
  65. line-height: 102rpx;
  66. border: none;
  67. margin-left: 30rpx;
  68. font-size: 30rpx;
  69. color: #303030;
  70. }
  71. .nic{
  72. font-size: 24rpx;
  73. font-weight: 400;
  74. color: #999999;
  75. line-height: 24rpx;
  76. margin-left: 30rpx;
  77. margin-top: 20rpx;
  78. }
  79. .inpTextBox {
  80. width: 90%;
  81. height: 100%;
  82. line-height: 102rpx;
  83. border: none;
  84. font-size: 30rpx;
  85. color: #303030;
  86. }
  87. .cev{
  88. width: 690rpx;
  89. height: 88rpx;
  90. background: #2671E2;
  91. border-radius: 8rpx;
  92. text-align: center;
  93. line-height: 88rpx;
  94. color: #FFFFFF;
  95. font-size: 30rpx;
  96. margin: 0 auto;
  97. margin-top: 220rpx;
  98. }
  99. </style>