selectsex.vue 3.8 KB

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