index.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. <template>
  2. <div class="wechat-view">
  3. <div class="header-view">
  4. <div class="hearder-kuang">
  5. <div class="header-img">
  6. <img src="/images/mobile/@2x/wechat/header-img.png" :src="headerImg"/>
  7. </div>
  8. </div>
  9. <div class="header-name">
  10. {{userName}}
  11. </div>
  12. <img src="/images/mobile/@2x/wechat/headerbg.png" class="headerbg"/>
  13. </div>
  14. <div class="middle-view">
  15. <ul>
  16. <li class="telphone">
  17. <input placeholder="请输入手机号" type="tel" maxlength="11" @blur="telphoneBlur" v-model="telphoneNum"/>
  18. </li>
  19. <li class="info">
  20. <div v-show="telerror">
  21. 请输入正确的手机号码
  22. </div>
  23. </li>
  24. <li class="password">
  25. <input placeholder="请输入密码" type="password" v-model="passwordNum"/>
  26. </li>
  27. </ul>
  28. <div class="loginBtn" @click="login">确定绑定已有账号登录</div>
  29. <div class="register">还没有优软账号,直接<span @click="resgiter">创建新账号</span></div>
  30. <nuxt-link :to="'/'" class="mobile_footer company" tag="div">
  31. <div class="hr"></div>
  32. <img src="/images/mobile/@2x/wechat/logo.png" alt="">
  33. <div class="hr right"></div>
  34. <!--<p>此页面由深圳市优软商城科技有限公司提供</p>-->
  35. <!--<nuxt-link :to="'/'">www.usoftmall.com</nuxt-link>-->
  36. <!-- <a href="https://www.usoftmall.com">www.usoftmall.com</a> -->
  37. </nuxt-link>
  38. </div>
  39. <remind-box :title="collectResult" :timeoutCount="timeoutCount"></remind-box>
  40. </div>
  41. </template>
  42. <script>
  43. import { RemindBox } from '~components/mobile/common'
  44. export default {
  45. name: 'wechatView',
  46. layout: 'mobileNoHeader',
  47. // middleware: 'authenticated',
  48. data() {
  49. return {
  50. collectResult: '',
  51. timeoutCount: 0,
  52. telerror: false,
  53. telphoneNum: '',
  54. passwordNum: ''
  55. }
  56. },
  57. mounted() {
  58. let info = localStorage.getItem('USOFTMALLWECHATINFO')
  59. this.$store.commit('option/REQUEST_WECHATINFO_STATUS_SUCCESS', JSON.parse(info))
  60. },
  61. methods: {
  62. telphoneBlur() {
  63. this.telerror = false
  64. if (!/^1[3|5|7|8]\d{9}$/.test(this.telphoneNum)) {
  65. this.telerror = true
  66. }
  67. },
  68. login() {
  69. if (this.telerror === true) {
  70. return false
  71. }
  72. let openid = this.$store.state.option.wechatInfo.data.openid
  73. this.$http.post('/wx/bindUser', {userTel: this.telphoneNum, userPwd: this.passwordNum, openId: openid}).then(res => {
  74. console.log(res)
  75. })
  76. },
  77. resgiter() {
  78. this.$http.get('/register/page').then(response => {
  79. if (response.data) {
  80. window.location.href = response.data.content
  81. }
  82. })
  83. }
  84. },
  85. components: {
  86. RemindBox
  87. },
  88. computed: {
  89. userName() {
  90. return this.$store.state.option.wechatInfo.data.nickname
  91. },
  92. headerImg() {
  93. return this.$store.state.option.wechatInfo.data.headimgurl
  94. }
  95. }
  96. }
  97. </script>
  98. <style scoped lang="scss">
  99. .wechat-view {
  100. position: fixed;
  101. z-index: 999;
  102. width: 100%;
  103. left: 0;
  104. right: 0;
  105. top: 0;
  106. bottom: 0;
  107. background: #fff;
  108. .header-view {
  109. background: #376ef3;
  110. height: 4.26rem;
  111. width: 100%;
  112. position: relative;
  113. padding-top: 0.56rem;
  114. .hearder-kuang {
  115. background: rgba(0, 0, 0, 0.18);
  116. width: 1.86rem;
  117. height: 1.86rem;
  118. border-radius: 50%;
  119. margin: 0 auto;
  120. overflow: hidden;
  121. position: relative;
  122. .header-img {
  123. background: #fff;
  124. width: 1.6rem;
  125. height: 1.6rem;
  126. border-radius: 50%;
  127. overflow: hidden;
  128. text-align: center;
  129. position: absolute;
  130. left: 50%;
  131. top: 50%;
  132. transform: translate3d(-50%, -50%, 0);
  133. img {
  134. width: 1.6rem;
  135. height: 1.6rem;
  136. border-radius: 50%;
  137. vertical-align: center;
  138. }
  139. }
  140. }
  141. .header-name {
  142. font-size: 0.3rem;
  143. color: #fff;
  144. text-align: center;
  145. margin-top: 0.24rem;
  146. }
  147. .headerbg {
  148. position: absolute;
  149. width: 100%;
  150. height: 0.88rem;
  151. bottom: 0px;
  152. left: 0px;
  153. }
  154. }
  155. .middle-view {
  156. padding: 0 0.71rem;
  157. margin-top: 0.56rem;
  158. ul li {
  159. padding-bottom: 0.1rem;
  160. min-height: 0.4rem;
  161. &.info {
  162. color: #3872f4;
  163. font-size: 0.24rem;
  164. margin-left: 0.64rem;
  165. margin-top: 0.2rem;
  166. margin-bottom: 0.2rem;
  167. }
  168. input {
  169. margin-left: 0.34rem;
  170. color: #aaa;
  171. font-size: 0.3rem;
  172. height: 0.5rem;
  173. line-height: 0.5rem;
  174. border: 0;
  175. display: inline-block;
  176. vertical-align: top;
  177. }
  178. &.telphone {
  179. border-bottom: 1px solid #eee;
  180. &::before {
  181. background: url('/images/mobile/@2x/wechat/tel_icon.png');
  182. content: ' ';
  183. width: 0.28rem;
  184. height: 0.5rem;
  185. display: inline-block;
  186. background-size: 100% 100%;
  187. vertical-align: top;
  188. }
  189. input {
  190. margin-left: 0.4rem;
  191. }
  192. }
  193. &.password {
  194. border-bottom: 1px solid #eee;
  195. &::before {
  196. background: url('/images/mobile/@2x/wechat/pass_icon.png');
  197. content: ' ';
  198. width: 0.34rem;
  199. height: 0.42rem;
  200. display: inline-block;
  201. background-size: 100% 100%;
  202. vertical-align: top;
  203. }
  204. }
  205. }
  206. .loginBtn {
  207. width: 5.8rem;
  208. height: 0.9rem;
  209. line-height: 0.9rem;
  210. text-align: center;
  211. font-size: 0.3rem;
  212. color: #fff;
  213. background: #376ef3;
  214. border-radius: 5px;
  215. margin: 1.29rem auto 0;
  216. }
  217. .register {
  218. width: 5.8rem;
  219. text-align: left;
  220. font-size: 0.24rem;
  221. color: #999;
  222. margin: 0.25rem auto 0;
  223. span {
  224. color: #0076ff;
  225. font-size: 0.24rem;
  226. text-align: center;
  227. border: 1px solid #0076ff;
  228. border-radius: 5px;
  229. height:0.44rem;
  230. width: 1.48rem;
  231. margin-left: 0.2rem;
  232. }
  233. }
  234. .company {
  235. margin-top: 1.51rem;
  236. position: relative;
  237. text-align: center;
  238. img {
  239. width: 1.78rem;
  240. height: 0.39rem;
  241. margin-top: 0.24rem;
  242. }
  243. p {
  244. font-size: 0.21rem;
  245. color: #aaa;
  246. margin: 0.13rem 0 0 0;
  247. }
  248. a {
  249. margin-top: 0.12rem;
  250. font-size: 0.18rem;
  251. color: #bbb;
  252. }
  253. .hr {
  254. width: 1.62rem;
  255. height: 0.02rem;
  256. background: #e3e3e3;
  257. position: absolute;
  258. left: 0.3rem;
  259. top: 0.45rem;
  260. &.right {
  261. right: 0.3rem;
  262. left: auto;
  263. }
  264. }
  265. }
  266. }
  267. }
  268. </style>