selectsex.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. <template>
  2. <uv-toast ref="toast"></uv-toast>
  3. <view class='titlearea'>
  4. <text class='title_2'>{{$t('select_gender_for_valuating_people')}}</text>
  5. <text class='title_member'>{{$t('valuating_people')}}:{{selectuser.membername}}</text>
  6. <text class='title_desstr' decode='true'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{$t('select_gender_text_1')}}</text>
  7. </view>
  8. <view>
  9. <uv-row justify="space-between" customStyle="margin-top: 6%">
  10. <uv-col span="6" align="center" @click="selectsex(1)">
  11. <uv-image class="img" src="/static/image/selecttype/man.png" mode="aspectFill"
  12. shape="circle" :lazy-load="true" width="150" height="150">
  13. </uv-image>
  14. <view class='mybtn' >{{$t('is_man')}}</view>
  15. </uv-col>
  16. <uv-col span="6" align="center" @click="selectsex(2)">
  17. <uv-image class="img" src="/static/image/selecttype/woman.png" mode="aspectFill"
  18. shape="circle" :lazy-load="true" width="150" height="150">
  19. </uv-image>
  20. <view class='mybtn' >{{$t('is_female')}}</view>
  21. </uv-col>
  22. </uv-row>
  23. </view>
  24. </template>
  25. <script>
  26. import {tohome,tostemlistnext} from "/common/js/common.js"
  27. import {subanswerbyuserid} from "/common/api/scale.js"
  28. import {submembergenderwithuid} from "/common/api/fmember.js"
  29. export default{
  30. data(){
  31. return{
  32. userinfo:{},
  33. selectuser:{},
  34. scaleid:0,
  35. srid:0,
  36. scaleid:0,
  37. stemid:3,
  38. answertype: 1,
  39. }
  40. },
  41. methods: {
  42. init(){
  43. this.userinfo = uni.getStorageSync("userinfo")
  44. this.selectuser = uni.getStorageSync("selectuser")
  45. },
  46. selectsex(sex){
  47. let answervalue = false
  48. let answeroptionid = false
  49. switch(sex){
  50. case 1:
  51. answervalue=this.$t('man');
  52. answeroptionid=64
  53. break;
  54. case 2:
  55. answervalue=this.$t('female');
  56. answeroptionid=65
  57. break;
  58. default:
  59. return
  60. break;
  61. }
  62. let answer={
  63. userid:this.userinfo.id,
  64. fmemberid:this.selectuser.fmemberid,
  65. stemid:this.stemid,
  66. answertype:this.answertype,
  67. answervalue:answervalue,
  68. answeroptionid:answeroptionid
  69. }
  70. let data={
  71. userid:this.userinfo.id,
  72. fmemberid:this.selectuser.fmemberid,
  73. srid: this.srid,
  74. scaleid: this.scaleid,
  75. }
  76. subanswerbyuserid(answer,data).then(res=>{
  77. res = res.data
  78. if(0==res.code){
  79. this.$refs.toast.show({
  80. type: 'error',
  81. message: res.errmsg
  82. })
  83. return false
  84. }
  85. if(200==res.code){
  86. uni.setStorage({
  87. key: 'srid',
  88. data: res.resultData,
  89. });
  90. let data1 = {
  91. userid:this.userinfo.id,
  92. fmemberid:this.selectuser.fmemberid,
  93. gender:sex
  94. }
  95. submembergenderwithuid(data1)
  96. tostemlistnext(this.sindex,1)
  97. }
  98. })
  99. }
  100. },
  101. mounted() {
  102. uni.setNavigationBarTitle({
  103. title: this.$t('select_sex')
  104. });
  105. this.init()
  106. },
  107. onLoad: function (option) {
  108. this.scaleid=option.scaleid
  109. this.srid=option.srid
  110. this.sindex = option.sindex
  111. },
  112. onBackPress:function(option){
  113. tohome()
  114. return true
  115. }
  116. }
  117. </script>
  118. <style scoped>
  119. .titlearea{
  120. height:400rpx;
  121. display:flex;
  122. flex-direction:column;
  123. justify-content: center;
  124. align-items:center;
  125. }
  126. .title_2{
  127. margin-top:15rpx;
  128. font-size:36rpx;
  129. font-weight:400;
  130. color:#666666
  131. }
  132. .title_member{
  133. margin-top:30rpx;
  134. font-size:36rpx;
  135. font-weight:400;
  136. color:#648EB8;
  137. }
  138. .title_desstr{
  139. width:700rpx;
  140. margin-left:25rpx;
  141. margin-top:30rpx;
  142. font-size:36rpx;
  143. font-weight:400;
  144. color:#9C9C9C;
  145. }
  146. .mybtn{
  147. width:50%;
  148. font-size: 15px;
  149. }
  150. </style>